This script will allow you to monitor the existence of a specific process on a remote machine, rather than a service.
Processes are much more difficult to Monitor than Services. The state of a Service may be determined, even if it is not running (stopped or disabled, for example). In a situation where it is necessary to monitor a machine to see if a specific process is running, this may be accomplished through the use of the EXEC Monitor and a third-party script.
The sample script returns the following:
- 0 if the process is running on the machine
- 1 if the process is not detected
It should be noted that the script will only detect the specific process if it is running at the same time the script is executed. If the process was launched and stopped between a test interval, the script will not be able to detect this fact.
Sample Monitor Settings
For the following example, we will assume the following:
Remote Machine: REMOTESRV
Process Name: notepad.exe
Script Location: c:\ipmscripts\
For Windows 2000
Executable Name: cscript.exe
Directory: c:\winnt\system32\
Command Line Parameters: perfmon_process.vbs REMOTESRV notepad.exe
Startup Directory: c:\ipmscripts\
Compare the Process Return Value = SELECTED
Expected Return Value: 0
For Windows XP / 2003
Executable Name: cscript.exe
Directory: c:\windows\system32\
Command Line Parameters: perfmon_process.vbs REMOTESRV notepad.exe
Startup Directory: c:\ipmscripts\
Compare the Process Return Value = SELECTED
Expected Return Value: 0
In the event the process is running on the remote machine, the script will return a 0, which will trigger an Alert.