Bug in notify-host-by-email variables

Ethan Galstad nagios at nagios.org
Sun Feb 10 18:22:53 CET 2008


Patrick Kremer wrote:
> 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.
> 
> 

I tested the $HOSTNOTES$ macro, and it seems to work fine for me in
notifications.  I don't think anything related to this was changed in
CVS since rc2, but I could be wrong.  Could you checkout the latest CVS
code and see if the problem remains?



Ethan Galstad
Nagios Developer
___
Email: nagios at nagios.org
Web:   www.nagios.org

-------------------------------------------------------------------------
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/




More information about the Developers mailing list