Skip to content

Commit

Permalink
Add hack to make json booleans work
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Sep 3, 2020
1 parent 360bba1 commit a19e7aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions check_json.pl
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
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);
}
# Magic hack to make the thing work with JSON values
if(JSON::is_bool($check_value)) {
$check_value = ( $check_value ? 'OK' : 'FAILED' );
}
if ( $check_value eq "true" or $check_value eq "false" ) {
if ( $check_value eq "true") {
$resultTmp = 0;
Expand Down

0 comments on commit a19e7aa

Please sign in to comment.