Thought I'd give a proper update here:
There were a couple of different issues that I found.
First, I found that the /usr/local/nagiosxi/scripts/nxti.php script has a bug. This is fixed in the attached script, and will at least allow the script to work from the CLI. Note that you'll need to change the file extension back to .php
nxti.txt
Second, there are some strange permissions set by default in debian, which prevent the apache user from sending an SNMP trap. These commands fixed it for me:
Code: Select all
chmod g+w /var/lib/snmp
usermod -a -G Debian-snmp www-data
My hope is that these two changes will at least get your service status changes working. I also found a third issue, which may be a bug in snmptt, and which is still preventing the received traps table from working properly. If you don't care about the details, feel free to skip to the very bottom of this post:
---
I manually changed the EXEC command to the following:
Code: Select all
php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*" >> /usr/local/nagiosxi/var/NXTI_Write_Test
Running snmptt in debug mode, I got the following command:
Code: Select all
EXEC line(s):
EXEC command:php /usr/local/nagiosxi/scripts/nxti.php --event_name="NXTI_Event_1" --event_oid=".1.3.6.1.4.1.8072.2.3.0.1" --numeric_oid=".1.3.6.1.4.1.8072.2.3.0.1" --symbolic_oid="netSnmpExampleHeartbeatNotification" --community="" --trap_hostname="localhost" --trap_ip="127.0.0.1" --agent_hostname="localhost" --agent_ip="127.0.0.1" --category="NXTI Test Event" --severity="Normal" --uptime="0:19:24:20.02" --datetime="2019-05-08 10:33:05" --unixtime="1557329585" --bindings="netSnmpExampleHeartbeatRate:123456" >> /usr/local/nagiosxi/var/NXTI_Write_Test
snmptt
Warning: require_once(/usr/local/nagiosxi/html/config.inc.php): failed to open stream: Permission denied in /usr/local/nagiosxi/scripts/nxti.php on line 6
Fatal error: require_once(): Failed opening required '/usr/local/nagiosxi/scripts/../html/config.inc.php' (include_path='.:/usr/share/php') in /usr/local/nagiosxi/scripts/nxti.php on line 6
But after giving snmptt a shell, I found that the command worked as expected:
Code: Select all
php /usr/local/nagiosxi/scripts/nxti.php --event_name="$N" --event_oid="$i" --numeric_oid="$o" --symbolic_oid="$O" --community="$C" --trap_hostname="$R" --trap_ip="$aR" --agent_hostname="$A" --agent_ip="$aA" --category="$c" --severity="$s" --uptime="$T" --datetime="$x $X" --unixtime="$@" --bindings="$+*"
debug: required files and connected to db
/* other debugging output */
---
Anyways, let me know how those first two changes work out for you, and I'll continue to work at this for a bit, and see if I can get in contact with the original author of snmptt
You do not have the required permissions to view the files attached to this post.