I need to ensure there are known amount of program’s processes currently running. How can I do that?
Q: A program should always be running, and there should be known amount of its processes. How to check that?
A: If you use version 4.0.9306 or newer of IPHost Network Monitor, you can use a WMI Process monitor to count running processes with a given name, and trigger an alarm if the count is unexpected. Click New Monitor button, select “Resources – Windows/WMI” category on the left and “WMI Process” Monitor. Select a host on the next page and configure the monitor parameters on the third page:
Switch to the State Conditions tab and configure Down state condition section Value Bounds, so that the monitor will switch to Down state if the processes count is less than 1 or greater than 2:
A: For any version of the IPHost Network Monitor you can use Custom Script or Program Monitor. Please download archive count-processes.zip from our scripts library.
Inside, you will find file count-processes.txt and “readme” file with installation instructions. At the moment, we assume you have created folder C:\scripts and unpacked the mentioned file there.
After you unpack it, rename count-processes.txt to count-processes.vbs.
Now open IPHost GUI client and create Script or Program monitor. At stage 3 of monitor creation wizard, enter script location and specify command-line arguments:
Note that this script takes two arguments: computer name and process name to count. If script is counting processes on the computer it’s running at, use single dot instead of computer network name (as on the screenshot above). To find a process name, you can run Windows Task manager (to avoid typos in process name and thus incorrect monitoring results).
Switch to State conditions tab, and create Down state condition: specify how many processes should always be running, unless monitor will enter Down state:
Click on “Finish” to conclude and start the monitor. In the example above, IPHost Web interface processes are counted. Normally, there should be at least 2 of them. Add the high limit value if necessary.
Note: if you wish to modify the script, use cscript utility to debug it. Open cmd.exe, and issue commands:
c: cd C:\scripts cscript //nologo count-processes.vbs . NMSWebServr.exe
to imitate the script behavior as in the example above. Note: use actual folder name you keep the script in.