Antwort: Printf issues with $output$ [Virus scanned]
Sascha Runschke
srunschke at abit.de
Fri Jan 21 15:08:17 CET 2005
I've already tried to address that problem, but sadly to no avail.
That behaviour of printf basically lies in the "bogus" interpretation of
"\ followed by a space" by /usr/bin/printf on some platforms.
The built-in Bash extension "printf" does not have that problem.
Therefor I am currently using a rather ugly construct to circumvent it:
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$\"" | /bin/mail -s "**
$NOTIFICATIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **"
$CONTACTEMAIL$
}
It would be much more appealing if the "illegal_macro_output_chars" would
be
parsed correctly. Even though I have \ in there, it doesn't get stripped.
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.
"Ian Davidson" <idavidso at juniper.net>
Gesendet von: nagios-users-admin at lists.sourceforge.net
20.01.2005 13:56
An: <nagios-users at lists.sourceforge.net>
Kopie:
Thema: [Nagios-users] Printf issues with $output$ [Virus scanned]
I've seen a few questions on this subject but have yet to find the
solution, so apologies if I'm going over old ground here.
I'm monitoring some Windows server disks and the resulting output is
along the lines of:
'c:\ - total: 16.92 Gb - used: 11.92 Gb (70%) - free 5.00 Gb (30%)', but
printf is cutting off everything after the 'c:' in the email alerts as
it is processing the backslash as an exit request. Any ideas how to get
around this??
Cheers,
Ian
---
Ian Davidson
Corporate Network Services
Email: idavidso at juniper.net
GSM: +44-7952-173703
Tel: +44-1372-385653
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20050121/23dd4c42/attachment.html>
More information about the Users
mailing list