SNMPTT integration issue


#1

I feel I am very close to getting this solved, but am stuck on one small thing.

I can receive traps, and process them with SNMPTT. However, the EXEC /usr/share/nagios3/plugins/eventhandlers/submit_check_result always fails with this error (I used 2> to redirect to a log file).

/usr/share/nagios3/plugins/eventhandlers/submit_check_result: 36: cannot create /var/lib/nagios3/rw/nagios.cmd: Permission denied

sudo ls -l /var/lib/nagios3/ gives:
drwxrwxr-- 2 nagios www-data 4096 2009-03-11 09:55 rw

sudo ls -l /var/lib/nagios3/rw gives:
prw-rw---- 1 nagios nagios 0 2009-03-12 00:51 nagios.cmd
So this file has user and group rw privileges.

id snmptt gives:
uid=1001(snmptt) gid=1001(snmptt) groups=1001(snmptt),33(www-data),118(nagios)
So snmptt is in the nagios group.

Also, the following command does work, and the result does show up in Nagios:
sudo -u snmptt /usr/share/nagios3/plugins/eventhandlers/submit_check_result hostname TRAP 1 “Message”

So, for some reason, when the snmptt script runs the submit_check_result command, it has a permissions failure, but if I run submit_check_result manually as the same user as the script uses (snmptt), it works! I don’t understand what could be going on, and what the difference is here. Any ideas?

Steve


#2

I found the solution here:
viewtopic.php?f=59&t=4342&p=15475&hilit=snmptt#p15475

Change #!/bin/sh to #!/bin/bash in submit_check_result. Then everything is good.

Steve