Does Nagios respect its own standards ?
DonKiShoot
donkishoot at wanadoo.fr
Tue Aug 21 20:09:40 CEST 2007
Hello,
I have a problem with perfdata and think that Nagios don't do what he
should (nagios 2.9).
First i check on Nagios plug-in development guidelines if the plug-in i
tried give good perfdata.
___________________________________________________________________________________________________________________________
Performance data is defined by Nagios as "everything after the | of the
plugin output" - please refer to Nagios documentation for information on
capturing this data to logfiles. However, it is the responsibility of
the plugin writer to ensure the performance data is in a "Nagios
plugins" format. This is the expected format:
'label'=value[UOM];[warn];[crit];[min];[max]
Notes:
1.
space separated list of label/value pairs
2.
label can contain any characters
3.
the single quotes for the label are optional. Required if spaces,
= or ' are in the label
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Then i look the output of my plugin :
________________________________________________________________________________________________________________________
HP NC7781 Gigabit Server Adapter:UP (0.0Mbps/0.0Mbps):1 UP: OK | 'HP
NC7781 Gigabit Server Adapter_in_bps'=9384;;;0;100000000 'HP NC7781
Gigabit Server Adapter_out_bps'=10849;;;0;100000000 'HP NC7781 Gigabit
Server Adapter_speed_bps'=100000000
----------------------------------------------------------------------------------------------------------------------------------------------------------------
For me it's ok, there is quotes for all the label
After i look my command line in Nagios :
________________________________________________________________________________________________________________________
$USER1$/process-service-perfdata "$LASTSERVICECHECK$" "$HOSTNAME$"
"$SERVICEDESC$" "$SERVICEOUTPUT$" "$SERVICESTATE$" "$SERVICEPERFDATA$"
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
And on my little program :
_________________________________________________________________________________________________________________________
TIMET=$1
HOSTNAME=$2
SERVICEDESC=$3
OUTPUT=$4
SERVICESTATE=$5
PERFDATA=$6
PERFFILE="/usr/local/nagios/var/service-perfdata"
/usr/bin/printf "%b"
"$TIMET\t$HOSTNAME\t$SERVICEDESC\t$OUTPUT\t$SERVICESTATE\t$PERFDATA\n"
>> $PERFFILE
------------------------------------------------------------------------------------------------------------------------------------------------------------------
In fact there is no transformation, only put in a file.
But when il look in the file :
__________________________________________________________________________________________________________________________
1187718367 SRV69DCEX01 NIC0 HP NC7781 Gigabit Server
Adapter:UP (0.0Mbps/0.0Mbps):1 UP: OK OK HP NC7781 Gigabit Server
Adapter_in_bps=7722;;;0;100000000 HP NC7781 Gigabit Server
Adapter_out_bps=6143;;;0;100000000 HP NC7781 Gigabit Server
Adapter_speed_bps=100000000
------------------------------------------------------------------------------------------------------------------------------------------------------------------
All quotes for the labels have disappear.
In development guideline it said "space separated list of label/value
pairs", i think it was to make difference between key of label/value pairs.
But if there is space in label, i can't parse this result without ton of
tests !!!
Why Nagios $SERVICEPERFDATA$ macro suppress quotes in labels if it is
required in development guidelines ?
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
More information about the Developers
mailing list