Page 1 of 1
Multiple values in performance graph
Posted: Tue Feb 20, 2018 4:38 am
by reincarne
Hi,
I created a plugin which supposed to write several metrics on the same graph.
What I did is create a variable which saves the performance output line and then I simple print if after the pipe as usual.
The line output looks like this:
108304=64.44%;;108306=65.74%;;108308=61.94%
The problem is that the graph is not being created.
What could be the problem?
Re: Multiple values in performance graph
Posted: Tue Feb 20, 2018 12:58 pm
by mcapra
Please refer to the
Nagios Plugin Development Guidelines.
Your labels need to be in single quotes. I would also suggest space-delimiting each label-value pair.
Re: Multiple values in performance graph
Posted: Tue Feb 20, 2018 1:07 pm
by lmiltchev
Thanks @mcapra!
@reincarne let us know if mcapra's suggestions helped you solve the issue.
Re: Multiple values in performance graph
Posted: Thu Feb 22, 2018 4:29 am
by reincarne
It didn't really help me.
What I'm doing is this:
Within a for loop, I'm creating a one line of performance data like this (using perl language);
for ($z=0; $z<$arrSizeNew2; $z++)
{
$sn=@results[$z];
#$sn=print"'$sn1'";
$pr=@results[$z+1];
$output=$sn."=".$pr.";";
#$output=exec(print "'$sn'=$pr;");
$perf_line.=$output;
$z=$z+4;
}
From this line, this will be an output example:
9866703=99.52;48666=38.34;20466=13.97;464613=33.35;103441=10.24;24444=16.27;899000=26.06
And the final output line goes like this:
print "Critical! SN ID: @results_excluded[$index_max-1], @results_excluded[$index_max]% Requests above 0.5s (@results_excluded[$index_max+1] out of @results_excluded[$index_max+2]) | $perf_line";
Re: Multiple values in performance graph
Posted: Thu Feb 22, 2018 1:22 pm
by lmiltchev
As @mcapra mentioned, there should be a space, separating the label-value pairs. It doesn't seem that you followed the nagios plugins development guidelines...
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 except the equals sign or single quote (')
3. the single quotes for the label are optional. Required if spaces are in the label
4. label length is arbitrary, but ideally the first 19 characters are unique (due to a limitation in RRD). Be aware of a limitation in the amount of data that NRPE returns to Nagios
5. to specify a quote character, use two single quotes
6. warn, crit, min or max may be null (for example, if the threshold is not defined or min and max do not apply). Trailing unfilled semicolons can be dropped
7. min and max are not required if UOM=%
8. value, min and max in class [-0-9.]. Must all be the same UOM. value may be a literal "U" instead, this would indicate that the actual value couldn't be determined
9. warn and crit are in the range format (see the Section called Threshold and Ranges). Must be the same UOM
10. UOM (unit of measurement) is one of:
1. no unit specified - assume a number (int or float) of things (eg, users, processes, load averages)
2. s - seconds (also us, ms)
3. % - percentage
4. B - bytes (also KB, MB, TB)
5. c - a continous counter (such as bytes transmitted on an interface)
It is up to third party programs to convert the Nagios Plugins performance data into graphs.
Your output doesn't contain spaces between label/value pairs:
9866703=99.52;48666=38.34;20466=13.97;464613=33.35;103441=10.24;24444=16.27;899000=26.06
Can you show the actual check, run from the command line and the output of it?