Professional Network and Server
Monitoring Tool

Download page Order page

IP Host Network Monitor - knowledge base

How to monitor a Windows process and restart it when it goes down?

A: In IPHost Network Monitor each monitor should return integer, so you have to SELECT some integer property of the process to be considered as a performance value for monitor. You may choose any integer property of the Win32_Process class, say ProcessId, HandleCount or VirtualSize form the list specified at:
http://msdn.microsoft.com/en-us/library/aa394372(VS.85).aspx

For example, you can use the following query:
SELECT ProcessId FROM Win32_Process WHERE Name = "startup.exe"

Windows process monitor setup

To restart the program you may use 2 options. Both use the alert configured to be executed once a monitor is switched to Down state:

  1. If you need to restart the program on the local host the IPHost is installed on, you may use the "Execute Program" alert in the "Run program" mode.
  2. If you need to restart the program on the remote server you would need to use the external VBS script. Put it somewhere on the server the IPHost is installed on and use the "Execute Program" alert in "Run Script" mode to run the program remotely.

The following simple VBS script which may be used for restart:

Restart.vbs file:
----------------------
Dim args
Set args = WScript.Arguments

strComputer = args(0)
strCommandLine = args(1)

Set objWMIService = GetObject _ 
    ("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process") 
  
Error = objWMIService.Create(strCommandLine, null, null, intProcessID) 

WScript.quit Error
----------------------

The script accepts 2 parameters: host name of the server to run program on and the command line. It may be started from the command prompt as:

    cscript restart.vbs server C:\\somedirectory\\startup.exe

To invoke script from IPHost Network Monitor you should create a custom alerting rule and alert for monitor and configure them as shown on the screenshots below:

Alerting rule

Restart Program Alert setup

For more details on how to configure alerts please refer to the appropriate Help topic.

To questions list

Related Topics:
Software application monitoring
Monitoring Remote Servers Through Firewalls

 
Demo video New PING Monitor Creation with IPHost Network Monitor - Demo Video New PING Monitor Creation
- Demo Video

 
What our customers are saying about IPHost Network Monitor

"Your product is a winner - and I am very particular, this no doubt is the BEST product that I have used - IPHost removes the complexity of installation and management, and the cost [of similarly functional competitive products] - thank goodness for others referring me to your company, otherwise I would have missed out on a good thing."

Jim Leatherman, IT Developer
American Alarm&Communications, Inc.


Privacy Policy