Re: /usr/bin/printf: %,: invalid directive. Time to shut up.

Stanley Hopcroft <[email protected]>
Newsgroups gmane.network.netsaint.user
Message-ID <[email protected]>
Dear Sir,

What I said may be related to the cause of this problem but then maybe 
not.

tsitc> printf '%s ' `/usr/local/netsaint/libexec/check_ping tsitc 5 10 
50.0 100.0 -p 10 -to 15 -nohtml`
PING ok - Packet loss = 0%, RTA = 0.08 ms tsitc> 
tsitc> 

tsitc> printf `/usr/local/netsaint/libexec/check_ping tsitc 5 10 50.0 
100.0 -p 10 -to 15 -nohtml`
printf: missing format character
PINGtsitc>

It may not be the ping command that's the culprit.

I do some more formatting in my notifiy commands :-

command[notify-by-email]=/usr/bin/printf '%s\n%s\n%s\n%s\n%s' '***** 
NetSaint 0.0.7 ***** $SERVICESTATE$ alert/notification' 'Date/Time: $D
ATETIME$', 'Service: $SERVICEDESC$' 'Host: $HOSTNAME$ Address: 
$HOSTADDRESS$', 'Additional Info: $OUTPUT$' | /usr/bin/mail -s '** 
$NOTIFICA
TIONTYPE$ alert - $HOSTNAME$/$SERVICEDESC$ is $SERVICESTATE$ **' 
$CONTACTEMAIL$


#command[notify-by-email]=/usr/bin/printf '***** NetSaint 0.0.7 ***** 
$SERVICESTATE$ alert/notification\nDate/Time: $DATETIME$\nService:\t$
SERVICEDESC$\nHost:\t$HOSTNAME$ Address: $HOSTADDRESS$\nAdditional 
Info:\n$OUTPUT$' | /usr/bin/mail -s '** $NOTIFICATIONTYPE$ alert - $HOST
NAME$/$SERVICEDESC$ is $SERVICESTATE$ **' $CONTACTEMAIL$


command[notify-by-epager]=/usr/bin/printf '%s' '$SERVICEDESC$ $HOSTNAME$ 
$SERVICESTATE$ $DATETIME$ $OUTPUT$' | /usr/bin/head -c 160 | /usr/
bin/mail $CONTACTPAGER$

So the answer to your question is that you should be able to do anything 
the shell allows.

Unfortunately I can't say what's causing the problem you are having 
unless you do __not__ have a format directive in your printf. However, 
my service notification by email looks like it would cause trouble,

The only sure way of finding the culprit is brute force :-

 . turn the appropriate debug define on in the source (see docco)

 . have sh run all your plugins and grep for '%' (except for ping 
perhaps)

Good luck.

Yours sincerely.


-- 
------------------------------------------------------------------------
Stanley Hopcroft
------------------------------------------------------------------------

'...No man is an island, entire of itself; every man is a piece of the
continent, a part of the main. If a clod be washed away by the sea,
Europe is the less, as well as if a promontory were, as well as if a
manor of thy friend's or of thine own were. Any man's death diminishes
me, because I am involved in mankind; and therefore never send to know
for whom the bell tolls; it tolls for thee...'

from Meditation 17, J Donne.


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.