SNMP - Getting information from a process

不问归期 提交于 2019-12-07 12:48:00

问题


I need to setup a process monitor on a number of servers using a monitoring tool called Zenoss. The problem I'm facing is how can I get information on a specific process via SNMP? I'm not familiar with SNMP at all and I'm having trouble finding out what I need.

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.

Any help here is appreciated.


回答1:


What you need is to query the hrSWRunTable in order to gather the information you need. 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). However how you do that "query" depends on the environment you're using, I am almost sure that vbs includes an SNMP library.




回答2:


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

HOST-RESOURCES-MIB::hrSWRunName




回答3:


Here is a example retrieval via NetSnmp from a Linux host. (I would have added this as a comment on the accepted answer from @raz3r, but I wanted ability to format the text!)

 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 



回答4:


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.



来源:https://stackoverflow.com/questions/9996178/snmp-getting-information-from-a-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!