Page 1 of 1

Re: Antwort: [Nagios-devel] backslash in plugin output

Posted: Mon Nov 28, 2005 11:26 am
by Guest
[email protected] writes:
>[email protected] schrieb am 28.11.2005 18:09:36:
>
>> This problem was previously reported on the nagiosplug-help list by
>> Sascha Runschke about a year ago (2004-11-03), but I could not find
>> any responses to that message in any Nagios or Nagios Plugin list.
>> Here's a link to the original message:
>>
>> http://sourceforge.net/mailarchive/mess ... id=9953710
>>
>> Does anybody have a solution for this problem?
>
>Personally I am using a rather dirty hack to circumvent
>this problem. Back then I started researching more into
>this topic and the actual fault lies in the implementation
>of various printf binaries. Most printf binary implementations
>are prone to the poblem, but not all are - though I was too
>lazy to find out why that like that.
>
>I just know that the bash-builtin printf is doing its job
>correct. Therefor I forced Nagios into using the bash-builtin
>like this:
>
>define command{
> command_name notify-by-email
> command_line /bin/bash -c "printf \"%b\" \"***** Nagios
>*****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService:
>$SERVICEDESC$\nHost: $HOSTNAME$\nDescription: $HOSTALIAS$\nAddress:
>$HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATE$
>$TIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\nProblem bestaetigen:
>http://nagios.abit.de/nagios/cgi-bin/cm ... ERVICEDESC$\""
>| /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is
>$SERVICESTATE$ **" $CONTACTEMAIL$
> }
>
>This command is perfectly able to handle all an every \ in
>your output.

Almost! Instead of "\\foo\net.work" I see "oo
et.work". So the name does appear, but it still gets interpreted.

It would appear that I'll have to write some dirty perl hack to read
the variables from the command line and then send the email.

It does seem, however, that it should work out of the box.

-- John


--
John Relph
NOAA/NESDIS/National Oceanographic Data Center





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]