Monitoring Windows application processes

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Post Reply
Jane Doe
Posts: 2
Joined: Thu Aug 31, 2023 1:35 am

Monitoring Windows application processes

Post by Jane Doe »

Hello

I'm using Nagios Core Version 4.4.9.
And I would like to know how to configure 'commands.cfg'.

I would like to monitor processes running on a certain Windows Server.
For example, I want to monitor a process named "qux" located on C:\foo\bar\baz.

I am trying to monitor this process with "commands.cfg".
But I searched a lot of web pages but couldn't catch the method.

What code should I write?
mmohamed

Re: Monitoring Windows application processes

Post by mmohamed »

Hello, Jane Doe

Thank you for reaching out, Ive provided some steps to help you setup Nagios Core to monitor this windows process (qux)

To monitor a specific process on a Windows machine using Nagios Core, you'll need to use the check_ncpa.py plugin, which is part of the Nagios Plugins package. This plugin communicates with the NCPA (agent installed on your Windows machine) to check various parameters, including running processes.

Installing the NCPA Agent on Windows

1.Download the latest stable NCPA agent to the system you are installing it on from here: https://nagios.org/ncpa/#downloads.
2.Double click on the NCPA.exe file to start the installation of the agent. Follow through all the required steps as described in our NCPA documentation here: https://www.nagios.org/ncpa/getting-started.php#windows

Installing the check_ncpa.py plugin on your Nagios server:

Run the following commands from the command line on your Nagios server:
cd /tmp
wget https://assets.nagios.com/downloads/ncp ... cpa.tar.gz
tar xvf check_ncpa.tar.gz
chown nagios:nagios check_ncpa.py
chmod 775 check_ncpa.py
mv check_ncpa.py /usr/local/nagios/libexec[/code]

To verify the version of the check_ncpa.py plugin, run the following command from the command line:

Code: Select all

/usr/local/nagios/libexec/check_ncpa.py -V
You should see something like this:

Code: Select all

check_ncpa.py, Version 1.1.0
Create the check command definition:

Create the check_ncpa_process command in your configuration files for Nagios Core, normally they are located in /usr/local/nagios/etc ----
In the commands.cfg file you will want to put this command to check for a process named "qux":

Code: Select all

define command{
    command_name    check_ncpa_process
    command_line    $USER1$/check_ncpa.py -H $HOSTADDRESS$ -t 'token' -P 5693 -M 'processes' -q 'name=qux'
}
In this command:
• $USER1$ is a variable that typically contains the path to your Nagios plugins directory.
• $HOSTADDRESS$ is the IP address or hostname of the Windows machine you're monitoring.
• 'token' should be replaced with the token you set up in the NCPA configuration on your Windows server.
• -p is the port NCPA is listening on & 5693 is the default port that NCPA listens on.
• 'processes' is the check_ncpa.py command that checks the state of a process.
• 'name=qux' is the query that specifies the name of the process you're checking.name of the process you're checking.

Create Nagios checks:

You can create the checks in a config file in /usr/local/nagios/etc.
For this case create a config file called windows.cfg with the following defined (Make sure to edit based on your own specific machine:

Define Host:

Code: Select all

define host{
    use             windows-server
    host_name       my-window-server
    alias           My Windows Server
    address         192.168.1.10
}
• windows-server is a template that includes a set of default values for various host parameters.
• my-window-server is the name of the host object.
• My Windows Server is a human-readable alias for the host.
• 192.168.1.10 Be sure to replace this with the IP address of the host.

Defines service check

Code: Select all

define service{
    use                 generic-service
    host_name           windows-server
    service_description Check qux process
    check_command       check_ncpa_process
}
• generic-service is a template that includes a set of default values for various service parameters.
• windows-server should be replaced with the name of the host object for your Windows server.
• Check qux process is a description of the service.
• check_ncpa_process tells Nagios to use the check_ncpa_process command to check for a process named "qux"

Documentation that can further provide insight on monitoring with Nagios Core on Nagios.org:
Monitoring Windows Machines: https://rb.gy/497ib
Monitoring Publicly Available Services: https://rb.gy/rlgor

If you have any other concerns please don't hesitate to reach back out on the support forum!

Mahad Mohamed
IT Specialist
Picture1.png
Picture1.png (2.41 KiB) Viewed 9644 times
1-888-NAGIOS-1 | www.nagios.com
"The Industry Standard In IT Infrastructure Monitoring’’
Jane Doe
Posts: 2
Joined: Thu Aug 31, 2023 1:35 am

Re: Monitoring Windows application processes

Post by Jane Doe »

Mr.Mahad Mohamed

Your advice helped me a lot.I haven't tried them yet, but I have a feeling they'll work. :D
Before I try them out, I wanted to say thank you so much, so I posted a comment.
Post Reply