NET-SNMP: Getting more detail into Disman Traps

安稳与你 提交于 2020-01-01 19:13:09

问题


I'm working on traps using NET-SNMP and the DISMAN Event MIB

With the following snmpd.conf configuration:

createUser disman MD5 sercrt@1
rouser disman auth
agentSecName disman
#defaultMonitors yes
disk / 90%
disk /var 85%
disk /opt 95%
disk /opt/pkgs 90%
disk /ufda 90%
proc cron
proc rtrcopy 1 1
proc socks1081 1 1
# monitor must have ".." in the line
monitor -u disman -r 30 -o prNames.1 -o prErrMessage.1 "Cron not running" prErrorFlag.1 != 0
monitor -u disman -r 30 -o prNames.2 -o prErrMessage.2 "rtrcopy running" prErrorFlag.2 != 0
monitor -u disman -r 30 -o prNames.3 -o prErrMessage.3 "socks1081 running" prErrorFlag.3 != 0
monitor -u disman -r 30  -o dskPath.1 -o dskErrorMsg.1 "/ is below 90%" dskErrorFlag.1 != 0
monitor -u disman -r 30  -o dskPath.2 -o dskErrorMsg.2 "/var is below 90%" dskErrorFlag.2 != 0
monitor -u disman -r 30  -o dskPath.3 -o dskErrorMsg.3 "/opt is below 90%" dskErrorFlag.3 != 0
monitor -u disman -r 30 -o dskPath.4 -o dskErrorMsg.4 "/opt/pkgs is below 90%" dskErrorFlag.4 != 0
monitor -u disman -r 30  -o dskPath.5 -o dskErrorMsg.5 "/ufda is below 90%" dskErrorFlag.5 != 0

I find that the disman trap is populating the following variables:

$1 = mteHotTrigger           dskTable  
$2 = mteHotTargetNameThe     '' 
$3 = mteHotContextName       ''
$4 = mteHotOID               .1.3.6.1.4.1.2021.9.1.100.2
$5 = mteHotValue             1

On an Event list this isn't very informative for Operators. I think if I could populate mteHotContextName, with the some kind of helpful text e.g. "/ is below 90%", then this would be much more useful

I can't see how to do this with the monitor directive

Does anyone know how to do this?


回答1:


That's actually what the -o switch is for: it lets you add additional objects to the notification being sent out. In your case, if you want the "helpful text" that is included in the error message value, you are doing the right thing by using the -o switch to include those objects. Why it's not working for you, I'm not sure. But you don't need a separate monitor line per row entry. Instead, use one that checks the value at every row. For example, the defaultMonitors configuration token actually specifies this:

monitor   -o prNames -o prErrMessage "process table" prErrorFlag != 0

Which checks every prErrorFlag at once.

The name you're using in quotes is just the name of the trigger, and that information isn't sent in the trap and you can't force it to be, unfortunately. It's simply an administrative name for the monitor that is used internally and in the DISMAN-MIB entries themselves to report the monitor.



来源:https://stackoverflow.com/questions/13156289/net-snmp-getting-more-detail-into-disman-traps

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