[Nagios-devel] printf bug...

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] printf bug...

Post by Guest »

Hello,

I think there is a bug

Sometimes (pings), the message contain some "%," which breaks the printf ...

----------------

SERVICE NOTIFICATION ATTEMPT: Service 'ping' on host 'kobold'
Current time: Tue Feb 12 14:31:08 2002
Current notification number: 1
Calculating next valid notification time...
Default interval: 1440
Interval used for calculating next valid notification time: 1440
Current Time: Tue Feb 12 14:31:08 2002
Next acceptable notification time: Wed Feb 13 14:31:08 2002
Service notification will NOT be escalated
Notify user xavier
Raw Command: /usr/bin/printf '***** Nagios 1.0a3 *****\n\nNotifica
tion Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddr
ess: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATETIME$\n\nAdditional
Info:\n\n$OUTPUT$' | /usr/bin/mail -s '** $NOTIFICATIONTYPE$ alert - $HOSTALIAS
$/$SERVICEDESC$ is $SERVICESTATE$ **' $CONTACTEMAIL$
Processed Command: /usr/bin/printf '***** Nagios 1.0a3 *****\n\nNotifica
tion Type: PROBLEM\n\nService: ping\nHost: Mail\nAddress: 203.225.20.23\nState:
WARNING\n\nDate/Time: Tue Feb 12 14:31:08 EST 2002\n\nAdditional Info:\n\nPING W
ARNING - Packet loss = 0%, RTA = 20.66 ms' | /usr/bin/mail -s '** PROBLEM alert
- Mail/ping is WARNING **' xavier@localhost
printf: illegal format character ,
mail: /home/xavier/.mail_aliases: No such file or directory
APPROPRIATE CONTACTS HAVE BEEN NOTIFIED

-------------------


what to do ?

use echo ?

escape the string before it's send to printf ?


thanks

xavier










This post was automatically imported from historical nagios-devel mailing list archives
Original poster: xavier@hansonpublications.com
Locked