chomp($cmd_result);
if ($cmd_result =~ /sudo/i) {
- print "$command CRITICAL - No sudo right to run the command\n";
+ print "$command CRITICAL - No sudo right to run the command | result=1;;;;\n";
exit($STATE_UNKNOWN);
} elsif ($expected_status ne '') {
if ($? != $expected_status) {
- print "$command CRITICAL - Response status $?\n";
+ print "$command CRITICAL - Response status $? | result=1;;;;\n";
exit($STATE_CRITICAL);
} else {
- print "$command OK - Response status $?\n";
+ print "$command OK - Response status $? | result=0;;;;\n";
exit($STATE_OK);
}
} elsif ($other_command ne '') {
if ($cmd_result ne $other_cmd_result) {
- print "$command CRITICAL - Expected output not matching other command output\n";
+ print "$command CRITICAL - Expected output not matching other command output | result=1;;;;\n";
exit($STATE_CRITICAL);
} else {
- print "$command OK - Expected output matching other command output\n";
+ print "$command OK - Expected output matching other command output | result=0;;;;\n";
exit($STATE_OK);
}
} else {
if ($cmd_result !~ /$expected_output/) {
- print "$command CRITICAL - Expected output not matching\n";
+ print "$command CRITICAL - Expected output not matching | result=1;;;;\n";
exit($STATE_CRITICAL);
} else {
- print "$command OK - Expected output matching\n";
+ print "$command OK - Expected output matching | result=0;;;;\n";
exit($STATE_OK);
}
}