notify-host-by-email - Variable problem

Patrick Kremer patrick at nicsys.net
Tue Jan 29 23:11:00 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          ; Inherit default values from a template
        host_name       intrust-bob-ds1              ; The name we're giving to this switch
        alias           Intrust BOB T1      ; A longer name associated with the switch
        address         66.243.142.155
        notes           TEST      
        icon_image      switch.gif
        statusmap_image switch.gd2
        hostgroups      intrust-office            ; Host groups this switch is associated with
        }   

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.

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$

I feel like I've found a bug but I really don't want to bother the developers if I've missed something obvious.

Has anyone else encountered this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20080129/ac294fc2/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-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list