This technique is not working. All I get back is a warning for that service, with the status info messageas: (null)
calling: java -cp MyJar.jar MyClass directly results in CRITICAL: (Return code of 127 is out of bounds - plugin may be missing) .
Am I correct in assuming that when you call the shell script, nagios is reading the shell script’s output and return code instead of the java that is being called from the shell script?
Yes, Nagios looks at the shell script output and it’s exit code. What you could do in a shell script is to redirect output of java plugin and java plugin exit code to some shell script variables and then use them as the shell output. For example:
[quote=“Albin”]
What you could do in a shell script is to redirect output of java plugin and java plugin exit code to some shell script variables and then use them as the shell output.[/quote]
Perfect. This solves my problem of calls from nagios to java.
For now I will solve my problem of multiple calls to java creating multiple vm’s by making one call to java that will do all the checks and log them, and then have separate checks getting the results from the logs.
I was suggested (elsewhere) that I run the java tests in a continuous loop elsewhere, with a sleep timer, and then testing those logs. But I think I prefer to have nagios call the java test and get a result to see if all the tests completed.