1
0
mirror of https://github.com/c-kr/check_json.git synced 2024-11-23 10:53:47 +01:00

small fix on divisor on check_value

This commit is contained in:
Benjamin Rokseth 2014-01-23 23:46:19 +01:00
parent b716491160
commit caeedf6435

View File

@ -111,22 +111,23 @@ if ($np->opts->perfvars) {
my $label = (split('->', $key))[-1]; my $label = (split('->', $key))[-1];
# make label ascii compatible # make label ascii compatible
$label =~ s/[^a-zA-Z0-9_-]//g ; $label =~ s/[^a-zA-Z0-9_-]//g ;
my $perf_val; my $perf_value;
$perf_val = eval '$json_response->'.$key; $perf_value = eval '$json_response->'.$key;
if ($np->opts->verbose) { print Dumper ("JSON key: ".$label.", JSON val: " . $perf_val) }; if ($np->opts->verbose) { print Dumper ("JSON key: ".$label.", JSON val: " . $perf_value) };
if ( defined($perf_val) ) { if ( defined($perf_value) ) {
push(@statusmsg, "$label: $perf_val");
# add threshold if attribute option matches key # add threshold if attribute option matches key
if ($key eq $np->opts->attribute) { if ($key eq $np->opts->attribute) {
push(@statusmsg, "$label: $check_value");
$np->add_perfdata( $np->add_perfdata(
label => lc $label, label => lc $label,
value => $perf_val, value => $check_value,
threshold => $np->threshold(), threshold => $np->threshold(),
); );
} else { } else {
push(@statusmsg, "$label: $perf_value");
$np->add_perfdata( $np->add_perfdata(
label => lc $label, label => lc $label,
value => $perf_val, value => $perf_value,
); );
} }
} }