diff --git a/check_json.pl b/check_json.pl index fb253c9..2330f63 100755 --- a/check_json.pl +++ b/check_json.pl @@ -139,8 +139,14 @@ my $json_response = decode_json($response->content); if ($np->opts->verbose) { (print Dumper ($json_response))}; my @attributes = split(',', $np->opts->attributes); -my @warning = split(',', $np->opts->warning); -my @critical = split(',', $np->opts->critical); +my @warning; +if ($np->opts->warning) { + @warning = split(',', $np->opts->warning); +} +my @critical; +if ($np->opts->critical) { + @critical = split(',', $np->opts->critical); +} my @divisor = $np->opts->divisor ? split(',',$np->opts->divisor) : () ; my %attributes = map { $attributes[$_] => { warning => $warning[$_] , critical => $critical[$_], divisor => ($divisor[$_] or 0) } } 0..$#attributes;