I''m using Winrpe-3.1.0 and I'm trying to confirure in a custom check that I wrote in Java. The program scans multiple user specified directories looking for the oldest file that is older than a user specified time. If this is the first time the file is returned a warning message and status are returned. If this is the second time the file is returned a critical message and status are returned. The java program works perfectly from JNRPE, but our IT staff favors Winrpe; therefore, how do I configure Winrpe to execute a java program.
My program is in an executable jar called "NagiosFileAge.jar". I created an entry in nrpe.cfg that looks like the following line:
command[run_test]="c:\Program Files\Java\jre7\bin\java.exe" -jar c:\NagiosFileAge.jar c:\aaa\PrevCheck c:\tmp
When I try executing the test from Nagios with "check_nrpe -H <my_test_ip> -c run_test" I get back "NRPE: Unable to read output". I replaced the command above with a call to a simple "cmd" file that echoes "Everything is working" and when I execute "check_nrpe -H <my_test_ip> -c run_test" this time I get back ""Everything is working". I've tested the "exe" files and some "cmd" files, but trying to execute a java program is not working.
I have several java monitoring programs that would benefit by being integrated into Nagios, but I really don't want to rewrite these programs to C. Any help on this would be appreciated.