mirror of
https://github.com/c-kr/check_json.git
synced 2024-11-23 10:53:47 +01:00
Merge remote-tracking branch 'PeerJ/master'
Conflicts: check_json.pl
This commit is contained in:
commit
b625118e1e
@ -11,6 +11,7 @@ use Data::Dumper;
|
|||||||
my $np = Nagios::Plugin->new(
|
my $np = Nagios::Plugin->new(
|
||||||
usage => "Usage: %s -u|--url <URL> -a|--attributes <attributes> "
|
usage => "Usage: %s -u|--url <URL> -a|--attributes <attributes> "
|
||||||
. "[ -c|--critical <thresholds> ] [ -w|--warning <thresholds> ] "
|
. "[ -c|--critical <thresholds> ] [ -w|--warning <thresholds> ] "
|
||||||
|
. "[ -e|--expect <value> ] "
|
||||||
. "[ -p|--perfvars <fields> ] "
|
. "[ -p|--perfvars <fields> ] "
|
||||||
. "[ -o|--outputvars <fields> ] "
|
. "[ -o|--outputvars <fields> ] "
|
||||||
. "[ -t|--timeout <timeout> ] "
|
. "[ -t|--timeout <timeout> ] "
|
||||||
@ -63,6 +64,11 @@ $np->add_arg(
|
|||||||
. 'for the threshold format. ',
|
. 'for the threshold format. ',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$np->add_arg(
|
||||||
|
spec => 'expect|e=s',
|
||||||
|
help => '-e, --expect expected value to see for attribute.',
|
||||||
|
);
|
||||||
|
|
||||||
$np->add_arg(
|
$np->add_arg(
|
||||||
spec => 'perfvars|p=s',
|
spec => 'perfvars|p=s',
|
||||||
help => "-p, --perfvars eg. '* or {shares}->{dead},{shares}->{live}'\n "
|
help => "-p, --perfvars eg. '* or {shares}->{dead},{shares}->{live}'\n "
|
||||||
@ -154,6 +160,10 @@ foreach my $attribute (sort keys %attributes){
|
|||||||
|
|
||||||
if ($attributes{$attribute}{'divisor'}) {
|
if ($attributes{$attribute}{'divisor'}) {
|
||||||
$check_value = $check_value/$attributes{$attribute}{'divisor'};
|
$check_value = $check_value/$attributes{$attribute}{'divisor'};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined $np->opts->expect && $np->opts->expect ne $check_value) {
|
||||||
|
$np->nagios_exit(CRITICAL, "Expected value (" . $np->opts->expect . ") not found. Actual: " . $check_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
my $resultTmp = $np->check_threshold(
|
my $resultTmp = $np->check_threshold(
|
||||||
|
Loading…
Reference in New Issue
Block a user