Responsibility for breaking notification output? (was: check_nt_disk - No Additional Info in email notification just drive letter)

Sascha Runschke srunschke-VuJELsoxrDI at public.gmane.org
Wed Nov 3 15:14:09 CET 2004


> For some reason, on the drive letter appears in the Additional Info
> section of the email notifications, not the space left/used, etc...
>
> Here is an example email:
[snipped] 
> C:

Reason for that is the way Nagios pipes the notifications into the 
commands.
Since it uses "/usr/bin/printf" to pipe them and "\" escape sequences for 
the formating,
the string "C:\ "make /usr/bin/printf bail out with an error. Therefor the 
output ends right at
the first occurance of "\ " (note the trailing space).

You can try the result at the commandline:

[root at SRV00032 root]# /usr/bin/printf "%b" "This is a test.\nIt will show 
how a backslash with a trailing space breaks /usr/bin/printf.\nBye Bye C:\ 
    \nYou won't see this!"
This is a test.
It will show how a backslash with a trailing space breaks /usr/bin/printf.
Bye Bye C:/usr/bin/printf: \ : invalid escape
[root at SRV00032 root]#

Everything after C: is actually STDERR and not STDOUT, therefor it doesn't 
get mailed.

The question now is: Who is responsible for this?

Should Nagios filter things like \ before passing them to the 
notify-commands?
Should there be a rule for plugins to not use "\ " in their output?

My opinion:
Nagios uses /usr/bin/printf per default, therefor it should make sure that 
the output passed
to it does not break it.

regards
        sash

IMPORTANT SIDENOTE: "/usr/bin/printf" is NOT the same as typing "printf" 
at the command line as
the latter is a built-in feature of bash! the bash built-in handles 
misquoted "\"s fine.

--------------------------------------------------
Sascha Runschke
Netzwerk Administration
IT-Services

ABIT AG
Robert-Bosch-Str. 1
40668 Meerbusch

Tel.:+49 (0) 2150.9153.226
mailto:SRunschke-VuJELsoxrDI at public.gmane.org

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20041103/c6c9e52c/attachment.html>


More information about the Users mailing list