Antwort: [Nagios-devel] backslash in plugin output
Posted: Mon Nov 28, 2005 9:52 am
[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.
Though you need to change it to fit your needs, I added
some sugar with the direct acknowledge link and such for
our non-pro Nagios users.
regards
sash
--------------------------------------------------
Sascha Runschke
Netzwerk Administration
IT-Services
ABIT AG
Robert-Bosch-Str. 1
40668 Meerbusch
Tel.:+49 (0) 2150.9153.226
Mobil:+49 (0) 173.5419665
mailto:[email protected]
http://www.abit.net
http://www.abit-epos.net
---------------------------------
Sicherheitshinweis zur E-Mail Kommunikation /
Security note regarding email communication:
http://www.abit.net/sicherheitshinweis.html
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> 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.
Though you need to change it to fit your needs, I added
some sugar with the direct acknowledge link and such for
our non-pro Nagios users.
regards
sash
--------------------------------------------------
Sascha Runschke
Netzwerk Administration
IT-Services
ABIT AG
Robert-Bosch-Str. 1
40668 Meerbusch
Tel.:+49 (0) 2150.9153.226
Mobil:+49 (0) 173.5419665
mailto:[email protected]
http://www.abit.net
http://www.abit-epos.net
---------------------------------
Sicherheitshinweis zur E-Mail Kommunikation /
Security note regarding email communication:
http://www.abit.net/sicherheitshinweis.html
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]