I followed a tutorial for setting SNMP trap for Nagios Core 4.4.3.
After Service snmptrapd executes the script:
#!/bin/sh
echocmd="/bin/echo"
CommandFile="/var/spool/nagios/cmd/nagios.cmd"
datetime=`date +%s`
cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4"
`$echocmd $cmdline >> $CommandFile`
It gives following error (found in /var/log/messages):
nagios: External command error: Command failed
How can this be fixed?
Edit : solved. Had to comment datetime and modify the next line of code the way Rohlik told me.
#!/bin/sh
echocmd="/bin/echo"
CommandFile="/var/spool/nagios/cmd/nagios.cmd"
####datetime=`date +%s`
cmdline="[$(date +%s)] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4"
`$echocmd $cmdline >> $CommandFile`