I installed the SNMP Trap handling as per this guide back on 11/16. Everything was working fine and traps were being received and translated to Nagios alerts, however since then, I am experiencing random crashes every few days with snmptt. When this happens, alerts aren’t created for any traps that are received (and /var/log/snmptt/snmptt.log shows no new events) . Upon restarting snmptt, the processing seems to pick back up where it left off, but this is less than ideal. Further analysis shows that this coincides during Nagios restarts typically when I'm applying a configuration change, but it doesn't happen on every restart.
Preliminary troubleshooting suggests that snmptt hangs when it tries to call snmptraphandling.py when the Nagios pipe (/usr/local/nagios/var/rw/nagios.cmd) isn't there (due to the Nagios restart).
I received an updated version of snmptraphandling.py from support which wraps a try-except clause around the opening of the Nagios pipe, but this has not solved the issue thus far.
Code: Select all
< try:
< output = open('/usr/local/nagios/var/rw/nagios.cmd', 'w')
< results = "[" + mytime + "] " + "PROCESS_SERVICE_CHECK_RESULT;" \
< + host + ";" + service + ";" \
< + return_code + ";" + mondata_res + "\n"
< output.write(results)
< except Exception, e:
< logger.error(e)
---
> output = open('/usr/local/nagios/var/rw/nagios.cmd', 'w')
> results = "[" + mytime + "] " + "PROCESS_SERVICE_CHECK_RESULT;" \
> + host + ";" + service + ";" \
> + return_code + ";" + mondata_res + "\n"
> output.write(results)
Code: Select all
[root@nagiosxi libexec]# /etc/init.d/snmptt restart
Stopping snmptt: [FAILED]
Starting snmptt: PID file: /var/run/snmptt.pid
[ OK ]
Code: Select all
Nagios XI Version : 2012R1.5
nagiosxi-01-blr 2.6.32-220.17.1.el6.i686 i686
CentOS release 6.2 (Final)
Gnome is not installed
# rpm -qa | grep snmptt
snmptt-1.3-3.nagios.noarch
# cat /etc/sysconfig/snmptrapd
# snmptrapd command line options
# OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
OPTIONS="-Lsd -On -p /var/run/snmptrapd.pid"
# cat /etc/snmp/snmptrapd.conf
disableAuthorization yes
traphandle default /usr/local/sbin/snmptthandler
# ps aux | grep snmptt
root 10382 0.0 0.0 4352 744 pts/1 S+ 15:55 0:00 grep snmptt
root 30873 0.0 0.0 16424 8040 ? Ss Dec06 0:01 /usr/bin/perl /usr/local/sbin/snmptt --daemon
root 30875 0.0 0.1 16480 9080 ? Ss Dec06 0:29 /usr/bin/perl /usr/local/sbin/snmptt –daemon
# ps aux | grep snmptrapd
root 5617 0.0 0.0 20156 5804 ? Ss Dec05 0:17 /usr/sbin/snmptrapd -Lsd -On -p /var/run/snmptrapd.pid
root 11186 0.0 0.0 4356 756 pts/1 S+ 15:56 0:00 grep snmptrapd