I’ve recently set up an Nagios central server and a test machine with installed NRPE to launch local plugins on the distant machine. This seems to work well but I’ve got a problem I was’nt able to solve yet:
When you check the status of an script to monitor the used disk space via the web interface, you get something like this:
Notice that Nagios is able to display the DISK WARNING message spit out by the plugin, that’s good. But it’s not so good that Nagios sends out problem alerts like this:
… the additional info is missing. Services that are checked localy on the Nagios main server display their additional info properly, but distant services via NRPE do not it seems.
Any idea on how to solve this?
You would have to look at your misccommands.cfg file. You might have messed it up some how.
it should read like this:
define command{
command_name notify-by-email
command_line /usr/bin/printf “%b” “***** Nagios ***\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /bin/mail -s " $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
}
When executed normally, it reports its status ok on the web interface and only an $ in the status e-mails. Now if I play around with the path to my mail, eg change
$LONGDATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /usr/bin/mail -s “**
to
$LONGDATETIME$\n\nAdditional Info:\n\n$OUTPUT$” | /usr/nothing -s "**
… then I get the following error output in /var/log/nagios/nagios.log:
[1135323570] Warning: Attempting to execute the command “/usr/bin/printf “%b” “***** Nagios ***\n\nNotification Type: PROBLEM\n\nService: DNS\nHost: Meskalin\nAddress: 10.2.0.5\nState: CRITICAL\n\nDate/Time: $DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /usr/nothing -s " PROBLEM alert - Meskalin/DNS is CRITICAL **” [email protected]” resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists…
Notice that $OUTPUT$ does not seem to get substituted. I’ve searched alot but was still not able to find where this problem may originate from. :?
That did it! Yes, I’m using Nagios 2 and after I changed $OUTPUT$ to $SERVICEOUTPUT$ the additional info displays properly in the e-mail notifications now. Thanks Luca!