[英]SNMP - Getting information from a process
I need to setup a process monitor on a number of servers using a monitoring tool called Zenoss. 我需要使用名为Zenoss的监视工具在多个服务器上设置进程监视器。 The problem I'm facing is how can I get information on a specific process via SNMP? 我面临的问题是如何通过SNMP获取有关特定流程的信息? I'm not familiar with SNMP at all and I'm having trouble finding out what I need. 我根本不熟悉SNMP,我很难找到我需要的东西。
I've been trying to use a tool called SNMP-Probe but it only seems to give basic system information, nothing that I need or can use. 我一直在尝试使用名为SNMP-Probe的工具,但它似乎只提供基本的系统信息,我只需要或不能使用它。
Any help here is appreciated. 任何帮助在这里表示赞赏。
What you need is to query the hrSWRunTable in order to gather the information you need. 您需要的是查询hrSWRunTable以收集所需的信息。 This MIB gives you a lot of information such as process name, path, type, status, parameters, CPU and RAM usage even though those two informations are stored on another MIB ( hrSWRunPerfEntry ). 此MIB为您提供了许多信息,例如进程名称,路径,类型,状态,参数,CPU和RAM使用情况,即使这两个信息存储在另一个MIB( hrSWRunPerfEntry )上。 However how you do that "query" depends on the environment you're using, I am almost sure that vbs includes an SNMP library. 但是,如何执行“查询”取决于您正在使用的环境,我几乎可以肯定vbs包含一个SNMP库。
I was just working on the same thing 我只是在做同样的事情
snmpwalk -v2c -c public xxx.xxx.xxx.xxx .1.3.6.1.2.1.25.4.2.1.2 snmpwalk -v2c -c public xxx.xxx.xxx.xxx .1.3.6.1.2.1.25.4.2.1.2
HOST-RESOURCES-MIB::hrSWRunName HOST-RESOURCES-MIB :: hrSWRunName
Here is a example retrieval via NetSnmp from a Linux host. 以下是从Linux主机通过NetSnmp进行的示例检索。 (I would have added this as a comment on the accepted answer from @raz3r, but I wanted ability to format the text!) (我会将此作为对@ raz3r接受的答案的评论添加,但我希望能够格式化文本!)
snmptable -v2c -Ci -c public myserver HOST-RESOURCES-MIB::hrSWRunTable
SNMP table: HOST-RESOURCES-MIB::hrSWRunTable
index hrSWRunIndex hrSWRunName hrSWRunID hrSWRunPath hrSWRunParameters hrSWRunType hrSWRunStatus
1 1 "init" SNMPv2-SMI::zeroDotZero "/sbin/init" "" application runnable
2 2 "kthreadd" SNMPv2-SMI::zeroDotZero "kthreadd" "" application runnable
3 3 "ksoftirqd/0" SNMPv2-SMI::zeroDotZero "ksoftirqd/0" "" application runnable
// other rows snipped for brevity
Unfortunately, I wasn't able to find out exactly how to do this. 不幸的是,我无法确切地知道如何做到这一点。 I ended up going with a vbs script on each machine to find the misbehaving process and kill it automatically. 我最终在每台机器上使用vbs脚本来查找行为不当的过程并自动终止它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.