Hello,
I would like to setup a java application monitoring mechanism in windows server machine using nagios. Requirement is like as follows.
I have 3 java process. I want to monitor each process specifically.
One of my java process run with command line argument like as follows
java -cp D:\publish\lib\mysql-connector-java-5.1.7-bin.jar;D:\publish\lib\Helpers.jar;D:\publish\lib\BatchPublisher.jar com.techlabs.products.publisher.batch.Main D:\publish\conf\demo_mainconfig1_com.xml
Second java process runs with command line argument like as
java -cp D:\publish\lib\mysql-connector-java-5.1.7-bin.jar;D:\publish\lib\Helpers.jar;D:\publish\lib\BatchPublisher.jar com.techlabs.products.publisher.batch.Main D:\publish\conf\demo_mainconfig2_com.xml
And so on.
I would like to monitor the java process with command line. Like say if a java process that is used by the file " D:\publish\conf\demo_mainconfig1_com.xml" get killed, I need to get the notification for that event.
I'm not sure if this can be achieved using CheckProcState. Is there any way I can monitor this process using nagios ? My java application is running on Windows Server 2008 machine.
Please advise.
monitor java process
Re: monitor java process
You can probably use the substring match in CheckProcState to look for demo_mainconfigX_com.xml
Former Nagios employee
Re: monitor java process
Hi,
Could you please tell me an example for reference ?
Could you please tell me an example for reference ?
Re: monitor java process
From the NSClient checkProcState page:
That example is for a regex, but you could probably swap it out for a substring match instead.Substrings and commandline
Check that cmd.exe with substring printloop in commandline is running:
[...]
Nagios Configuration:
From Commandline (with NRPE):Code: Select all
define command { command_name <<CheckProcState>> command_line check_nrpe -H $HOSTADDRESS$ -p 5666 -c CheckProcState -a match=regexp cmdLine ShowAll .*cmd.*$ARG1$.*=started }
Code: Select all
check_nrpe -H IP -p 5666 -c CheckProcState -a match=regexp cmdLine ShowAll .*cmd.*printloop.*=started
Former Nagios employee
Re: monitor java process
well, I decided to use check_wmi_plus.pl for monitoring the process. Details are as follows
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml
OK - Found 1 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). (List is on next line)|'Process Count'=1; 'Excluded Process Count'=0;
The process(es) found are java.exe
It is showing "OK" message when I check for the java.exe process having command line argument "demo_mainconfig1_com.xml"
Suppose if I kill the process and run the same check again, its showing as follows
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml
OK - Found 0 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). |'Process Count'=0; 'Excluded Process Count'=0;
It is still showing OK message. How do I get "CRITICAL" message when there is no such java.exe instance is running on remote host using check_wmi_plus.pl plugin ?
Thank You
- Linson J
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml
OK - Found 1 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). (List is on next line)|'Process Count'=1; 'Excluded Process Count'=0;
The process(es) found are java.exe
It is showing "OK" message when I check for the java.exe process having command line argument "demo_mainconfig1_com.xml"
Suppose if I kill the process and run the same check again, its showing as follows
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml
OK - Found 0 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). |'Process Count'=0; 'Excluded Process Count'=0;
It is still showing OK message. How do I get "CRITICAL" message when there is no such java.exe instance is running on remote host using check_wmi_plus.pl plugin ?
Thank You
- Linson J
Re: monitor java process
Well I found the solution. Trick here was to use "-w 1:10 -c 1:20" at the end of the command line check
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml -w 1:10 -c 1:20
OK - Found 1 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). (List is on next line)|'Process Count'=1; 'Excluded Process Count'=0;
The process(es) found are java.exe
After killing the process,
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml -w 1:10 -c 1:20
CRITICAL - [Triggered by _ItemCount<1] - Found 0 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). |'Process Count'=0;10;20; 'Excluded Process Count'=0;
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml -w 1:10 -c 1:20
OK - Found 1 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). (List is on next line)|'Process Count'=1; 'Excluded Process Count'=0;
The process(es) found are java.exe
After killing the process,
:~# /usr/local/nagios/libexec/check-wmi/check_wmi_plus.pl -H 10.5.10.21 -u administrator -p xxxxxxx -m checkprocess -s comm -a demo_mainconfig1_com.xml -w 1:10 -c 1:20
CRITICAL - [Triggered by _ItemCount<1] - Found 0 Instance(s) of "demo_mainconfig1_com.xml" running (0 excluded). |'Process Count'=0;10;20; 'Excluded Process Count'=0;