Antwort: Backslash problems in notifications [Virus scanned]
Sascha Runschke
srunschke at abit.de
Thu Feb 10 09:39:09 CET 2005
> Now, for most alerts this works fine. But for the disk space alerts,
> printf looks at the backslash followed by a one and reports it as being
> an invalid escape sequence. The e-mail comes through but is truncated
> from the word "on", thus blasting away the last half of the alert
> message.
This is a known issue.
Ethan should have updated the CVS by now and a new snapshot should
fix the problem. You just need to add \ to the illegal_macro_chars
variable in nagios.cfg, if not done already.
If using the newest snapshot is not feasable for you, you can use
this workaround:
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\n\"" | /bin/mail -s "**
$NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **"
$CONTACTEMAIL$
}
The built-in printf function of bash doesn't suffer from misinterpreting
wrong escapesequences.
sash
--------------------------------------------------
Sascha Runschke
Netzwerk Administration
IT-Services
ABIT AG
Robert-Bosch-Str. 1
40668 Meerbusch
Tel.:+49 (0) 2150.9153.226
mailto:SRunschke at abit.de
http://www.abit.net
http://www.abit-epos.net
http://www.my-academy.net
--------------------------------------------------
Der Inhalt dieser Email sowie die Anhänge sind ausschließlich für den
bezeichneten Adressaten bestimmt. Wenn Sie nicht der vorgesehene Adressat
dieser Email oder dessen Vertreter sein sollten, so beachten Sie bitte,
daß jede Form der Kenntnisnahme, Veröffentlichung, Vervielfältigung oder
Weitergabe des Inhalts dieser Email unzulässig ist. Wir möchten Sie
außerdem darauf hinweisen, daß die Kommunikation per Email über das
Internet unsicher ist, da fuer unberechtigte Dritte grundsätzlich die
Möglichkeit der Kenntnisnahme und Manipulation besteht. Wenn Sie diese
Nachricht versehentlich erhalten, informieren Sie bitte den Absender und
löschen diese Nachricht mit den Anhängen. Herzlichen Dank
The information and any attachments contained in this email are intended
solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any form of
disclosure, reproduction, distribution or any action taken or refrained
from in reliance on it, is prohibited and may be unlawful. We also like to
inform you that communication via email over the internet is insecure
because third parties may have the possibility to access and manipulate
emails. If you have received the message in error, please advise the
sender and delete the message and any attachments. Thank you very much.
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click
_______________________________________________
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