Page 1 of 2

Monitoring Java Program on a Windows PC

Posted: Sun Jun 04, 2017 4:35 pm
by Nisbo
Hello,

I am new to Nagios and a Linux Noob and I want to check if a Java Program (RepeaterReader.jar) is running on a Windows 10 PC
NSCP-0.5.0.62-x64.msi is running on this PC, the DiskSpace, CPU etc check works fine

I added this service to my windows.cfg
define service{
use generic-service
host_name Intel-NUC
service_description RepeaterReader
check_command check_nt!PROCSTATE!-d SHOWALL -l RepeaterReader.jar
}
but it did not work.

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 8:49 am
by mdomanski
Could You please show also command definition of check_nt

Example usage for procstate based on check_nt:

Code: Select all

./check_nt -H $HOSTADDRESS$ -p 12489 -s password -v PROCSTATE -l explorer.exe -d SHOWALL

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 9:36 am
by dwhitfield
Thanks for the assist @mdomanski!

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 11:00 am
by Nisbo
mdomanski wrote:Could You please show also command definition of check_nt

Example usage for procstate based on check_nt:

Code: Select all

./check_nt -H $HOSTADDRESS$ -p 12489 -s password -v PROCSTATE -l explorer.exe -d SHOWALL
Sorry I am unable to understand what you are talking about.
Currently I am using this service definition
define service{
use generic-service
host_name Intel-NUC
service_description RepeaterReader
check_command check_nt!PROCSTATE!-d SHOWALL -l javaw.exe
}
this works fine but it monitors only Java, I want to monitor a Java Program

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 11:54 am
by mcapra
I can almost guarantee you'll need to be using check_nrpe instead of check_nt. Here's some documentation about how to enable your NSClient++ setup to allow check_nrpe connections (it says "Nagios XI" but this is applicable to Core):
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Once NSClient++ is ready for check_nrpe connections, you need to be looking at the command line arguments for the Java processes to identify a specific JAR file. In the Windows Task Manager, it might look similar to like this:
2017_06_05_11_55_27_Windows_Task_Manager.png
You can do this with a NSClient++ filter rule. Something like this might be a good place to start:

Code: Select all

/path/to/check_nrpe -H 192.168.142.137 -t 30 -c check_process -a process="javaw.exe" "filter=command_line like 'my_program.jar'"
I haven't tested the above though, so the syntax might be a bit dodgy.

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 12:35 pm
by avandemore
Very insightful @mcapra!
@Nisbo does this answer your question?

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 12:38 pm
by Nisbo
I have to try it later, I will keep you informed :)

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 1:38 pm
by avandemore
Sounds good, we'll leave this open for now.

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 1:57 pm
by Nisbo
The Windows part works fine, the shell command reports: File or Folder not found
Screenshot_255.jpg

Re: Monitoring Java Program on a Windows PC

Posted: Mon Jun 05, 2017 3:26 pm
by avandemore
What is the output of:

Code: Select all

# stat /usr/local/nagios/libexec/check_nrpe
# ldd /usr/local/nagios/libexec/check_nrpe
# /usr/local/nagios/libexec/check_nrpe -h | head -n 4