From caeedf6435b574353d2d6808f8267bb94b4fa0da Mon Sep 17 00:00:00 2001 From: Benjamin Rokseth Date: Thu, 23 Jan 2014 23:46:19 +0100 Subject: [PATCH] small fix on divisor on check_value --- check_json.pl | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/check_json.pl b/check_json.pl index 91466e3..638e880 100755 --- a/check_json.pl +++ b/check_json.pl @@ -111,22 +111,23 @@ if ($np->opts->perfvars) { my $label = (split('->', $key))[-1]; # make label ascii compatible $label =~ s/[^a-zA-Z0-9_-]//g ; - my $perf_val; - $perf_val = eval '$json_response->'.$key; - if ($np->opts->verbose) { print Dumper ("JSON key: ".$label.", JSON val: " . $perf_val) }; - if ( defined($perf_val) ) { - push(@statusmsg, "$label: $perf_val"); + my $perf_value; + $perf_value = eval '$json_response->'.$key; + if ($np->opts->verbose) { print Dumper ("JSON key: ".$label.", JSON val: " . $perf_value) }; + if ( defined($perf_value) ) { # add threshold if attribute option matches key if ($key eq $np->opts->attribute) { + push(@statusmsg, "$label: $check_value"); $np->add_perfdata( label => lc $label, - value => $perf_val, + value => $check_value, threshold => $np->threshold(), ); } else { + push(@statusmsg, "$label: $perf_value"); $np->add_perfdata( label => lc $label, - value => $perf_val, + value => $perf_value, ); } }