Line breaks in notifications ignored

mark.potter at academy.com mark.potter at academy.com
Wed Nov 21 16:11:21 CET 2007


"Tal Cohen" <nagios at cohen123.com> wrote on 11/21/2007 08:35:51 AM:

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

Double backslashes produce the same results unfortunately. It doesn't make 
much sense to me that they would but they do. Thanks, though, for the 
response!


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