I need a check that will alert if 15 or more instantnaces of cmd.exe is running on a host. We have a system that runs several bat files on another system (thus using cmd.exe) The calling system is able to check to insure it's running, but if it 'hangs' the calling system will start another instance. If the first instanance is hung, then the second, third, forth, etc still wont run becasue the first is stuck.
So anyway, I need a check that will let me know if more than 14 instanaces of cmd.exe is running.
Any ideas?
Check for multiple instances of a running program
Check for multiple instances of a running program
Everybody is somebody else’s weirdo
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Check for multiple instances of a running program
Correct me if I'm wrong, but https://exchange.nagios.org//directory/ ... nt/details seems like exactly what you want.
Re: Check for multiple instances of a running program
Or if you're using ncpa you can do this with:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H <client.ip> -t '<token>' -M 'processes' -c 15 -q 'name=cmd.exe'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Check for multiple instances of a running program
in therory the plugin from exchange.nagios would work, except the website that has the 2 other part that is needed, doesn't exist anymore
This plugin relied on two specific pieces to work properly
if at all:
NC_Net (http://http://www.shatterit.com/nc_net/) on the client
and
check_nt (http://www.shatterit.com/nc_net/files/check_nt.c)
This plugin relied on two specific pieces to work properly
if at all:
NC_Net (http://http://www.shatterit.com/nc_net/) on the client
and
check_nt (http://www.shatterit.com/nc_net/files/check_nt.c)
Everybody is somebody else’s weirdo
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Check for multiple instances of a running program
When archive.org is back up I'll take a look (https://archive.org/search.php?query=ht ... Fnc_net%2F), but is NCPA an option for you?
Re: Check for multiple instances of a running program
you can go ahead and close this item.
I got thinking over the weekend that since I'm wanting to check this against a windows machine, why not do it in powershell.
so in powershell I came up with this simple little script:
I got thinking over the weekend that since I'm wanting to check this against a windows machine, why not do it in powershell.
so in powershell I came up with this simple little script:
Code: Select all
param($num, $executablename)
$ErrorActionPreference = "SilentlyContinue"
$NumofProcess = (Get-Process -Name $executablename).Count
if ($NumofProcess -gt $num)
{$LastExitCode = 2}
else
{$LastExitCode = 0}
write-host $LastExitCode
exit $LastExitCode
Everybody is somebody else’s weirdo