Configure services monitor

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
luigi.mazzucchetti
Posts: 1
Joined: Thu Sep 16, 2004 8:28 am

Configure services monitor

Post by luigi.mazzucchetti »

Is there a way to monitor all the services on a system that must start in "automatic mode" and they aren't "started" without configuring a rule for every service?
Thanks.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Sorry, HostMonitor does not have such option. You should create separate test item for each service.
On the other hand, you may create single test to monitor Event Log. Windows records message when some service was not started.

Regards
Alex
nicksp
Posts: 7
Joined: Tue Jan 20, 2004 2:08 am

Script to monitor failed auto services

Post by nicksp »

Hi,
Here is a script that we use - it uses wmi to query for all services whos start type = auto and status <> started. Returns the name(s) of the failed services.
Here is the code - it is a bit rough but you should get the drift.

Code: Select all

Option Explicit

const statusAlive       = "Host is alive:"
const statusDead        = "No answer:"
const statusUnknown     = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk          = "Ok:"
const statusBad         = "Bad:"
const statusBadContents = "Bad contents:"

'---- entry point ----

FUNCTION performtest()
  Dim strComputer, qryWMI, failedservices, objWMIService, colServices, objService
  IF "%Reply%"="%"+"Reply"+"%" THEN
     performtest = statusUnknown+"Please enable 'Translate macros' option"
  ELSE
	' query all services that are stopped and startup type is auto
	strComputer = "."
	qryWMI = "Select * from Win32_Service where State='Stopped' AND StartMode='Auto' "

	Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	Set colServices = objWMIService.ExecQuery(qryWMI)

	IF colServices.count > 0 THEN
		For Each objService in colServices 
			failedServices = failedServices & objService.DisplayName & " "
		Next
		PerformTest = statusBAD & failedservices
	ELSE
		PerformTest = statusOK
	END IF

END IF
END FUNCTION
Nick
Post Reply