Page 1 of 1

need to monitor several Windows process with same exe

Posted: Tue Aug 15, 2023 4:11 pm
by gkrupitsky
How to monitor several Windows process that start with same command.exe but from different config files, located on different
locations, on same drive.
Under Task manager I see 5-6 processes with same name, each has different process id because it was started with a different conf file (each conf file is located on a different path).

In check_nt or check_nrpe what $arg$ can I specify to look at the path of the config file, from which the command.exe(process name) was started.
I am looking for the process status up or down.

Re: need to monitor several Windows process with same exe

Posted: Wed Aug 16, 2023 11:59 am
by swolf
Hi @gkrupitsky, thanks for reaching out.

As far as I'm aware, this isn't built-in for any supported Windows agents, so you'll need to write a custom plugin. For Windows, I would recommend doing it with a PowerShell script.

To get you started, it looks like you can get a full list of running processes and their command-line options with this PowerShell command:

Code: Select all

gwmi Win32_Process | select CommandLine
From there, you should be able to write a script that is compatible with our plugin development guidelines (this part is simpler than it sounds - just try it). It sounds like you'll need to make a plugin that accepts the name of the config file as an argument and tells you whether there's a specific process running with this .exe name and config file.

Once you have a working plugin, I would expect it to work the same across NCPA/NSClient/any other nagios-compatible agent.

Hopefully that helps. Let me know how it turns out for you, or if you run into any roadblocks along the way.

-Sebastian Wolf

Re: need to monitor several Windows process with same exe

Posted: Wed Aug 16, 2023 3:18 pm
by gkrupitsky
Thank you Sebastian, much appreciated.
I will try that, let's see how that goes.

Re: need to monitor several Windows process with same exe

Posted: Thu Aug 17, 2023 10:38 am
by swolf
Best of luck to you!

I'm leaving a reply here so that other members of the team know this thread is "handled" until you have time to try the solution.