Line breaks in notifications ignored

Tal Cohen nagios at cohen123.com
Wed Nov 21 15:35:51 CET 2007


Looks like the back slash is getting escaped out. Try double backslashes:
\\n instead of \n.

 

Tal

 

  _____  

From: nagios-users-bounces at lists.sourceforge.net
[mailto:nagios-users-bounces at lists.sourceforge.net] On Behalf Of
mark.potter at academy.com
Sent: Wednesday, November 21, 2007 9:33 AM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Line breaks in notifications ignored

 


I am pretty sure I have seen the answer to this but I have searched the
archives, google, and my own archives (since I joined the list) and can't
seem to find where I saw this mentioned before. I have notification commands
such as: 

define command{ 
        command_name    host-notify-by-email 
        command_line    /usr/bin/printf "%b" "** Nagios **\n\nNotification
Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" |
/usr/bin/mailx -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$ 
        } 

When I run: /usr/bin/printf "%b" "** Nagios **\n\nNotification Type" from
the command line it appears correctly, with the \n inserting a line break,
however when Nagios sends an alert I get the alert with no line breaks and
an"nn" or "n" (depending on the break) where it should have been. I am
stumped at the moment. I have been over the docs but only found the macros
listing. I have a sneaking suspicion that it may have something to do with
2.9/2.10 upgrades but that didn't make much sense to me. I have tried
escaping the breaks but the same thing happens as if there weren't any
escapes there at all. 

Nagios 2.10 
SLES: 9 patch level 3

Any help at all, even just the right google phrase for which to search,
would really be appreciated! 

Best Regards,

Mark L. Potter
Systems Engineer
Academy Sports & Outdoors
1800 N. Mason Rd
Katy, Texas 77449
Office: 281-646-5857
Cell: 281-734-6965

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20071121/cf9b6e13/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
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