Bug in notify-host-by-email variables
Patrick Kremer
patrick at nicsys.net
Thu Jan 31 03:44:28 CET 2008
I am running 3.0rc2. I am trying to get the variable $HOSTNOTES$ to appear in notify-host-by-email
This is the notify-host-by-email command definition that I changed. I added "Notes: $HOSTNOTES$\n\n" in the spot shown below:
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nNotes: $HOSTNOTES$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
The host I'm testing with contains only the word: TEST in its notes field.
define host{
use generic-router-intrust
host_name intrust-bob-ds1
alias Intrust BOB T1
address 66.243.142.155
notes TEST
icon_image switch.gif
statusmap_image switch.gd2
hostgroups intrust-office
}
This is the debug log output:
[1201644173.199143] [032.2] [pid=30977] Raw Command: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nNotes: $HOSTNOTES$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
[1201644173.199170] [032.2] [pid=30977] Processed Command: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\nHost: intrust-bob-ds1\nState: DOWN\nAddress: 66.243.142.155\nInfo: (Host Check Timed Out)\n\nNotes: TEST
The problem is that the processed command gets truncated and a notification never gets sent. If I change the notify-host-by-email definition and replace $HOSTNOTES$ with another variable, $HOSTOUTPUT$ for instance, the debug log shows this:
[1201644289.198269] [032.2] [pid=30977] Raw Command: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nNotes: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
[1201644289.198292] [032.2] [pid=30977] Processed Command: /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\nHost: intrust-bob-ds1\nState: DOWN\nAddress: 66.243.142.155\nInfo: (Host Check Timed Out)\n\nNotes: (Host Check Timed Out)\n\nDate/Time: Tue Jan 29 16:04:49 CST 2008" | /usr/bin/mailx -s "** PROBLEM Host Alert: intrust-bob-ds1 is DOWN **" pat at nicsys.net
The notification gets sent successfully because the processed command is not truncated.
I know I have the syntax correct because I have it working with other variables - it just wont work when I plug in the variable that I want: $HOSTNOTES$. It is listed as allowed in host notifications in the docs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20080130/4985678a/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel
More information about the Developers
mailing list