no macros for service perfdata processing command

Mark Frost mfrost66 at optonline.net
Thu Apr 6 16:48:45 CEST 2006


Hello.

I was working on making nagiosgraph/rrdtool work with my Nagios 2.0
installation when I came upon this issue.

I have the following in nagios.cfg:

process_performance_data=1
service_perfdata_file=/var/spool/nagios/perfdata.log
service_perfdata_file_template=[SERVICEPERFDATA]\t$TIME$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$
service_perfdata_file_processing_command=process-service-perfdata


In checkcommands.cfg I initially tried the default of:

define command {
    command_name    process-service-perfdata
    command_line    /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /usr/local/nagios/var/service-perfdata.out
}


I found that I saw output that I expected in
/var/spool/nagios/perfdata.log (i.e. real hostname, servicename, stuff,
etc), but the target file of the process-service-perfdata command
yielded nothing but emtpy lines.

I tried replacing the printf with simple echo's of individual macros and
got nothing.  I changed the command line to a shell script that did
nothing but echo it's shell environment to a file and any arguments
passed on the command line.  The shell environment showed up in the file
but the only things that showed up from the shell script's command line
were non-macros.  For example, I had

command_line   /usr/local/nagios/etc/M.sh  FOO $HOSTNAME$

and I'd see "FOO" in the output file.  The shell script had an "env >>
/tmp/output" line in it so I could see the shell environment.  There
were lots of nagios env variables there, but most were empty including
things like $NAGIOS_SERVICEDESC.

Clearly the macros are being expanded elsewhere (host/service checking
commands, and writing directly to the perfdata file), but I can't get
them to be available at all with my perfdata processing command.

What am I doing wrong?

I've recently fired up Nagios 2.1 and run with the same configuration
and it made no difference.

Thanks

Mark




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
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