Monitoring a service for State and StartMode

Published Mar 12 2019 04:45 PM 196 Views
Microsoft

First published on TECHNET on Aug 09, 2008

I recently had a customer that wants to get an alert when a specific service is not Disabled and/or not Stopped.  I used the following steps to accomplish this using a "Timed Script Three State Monitor".  Even if you do not have this specific need, these steps can be used as a template for creating a monitor that uses a script to query WMI and change state or generate alerts based on the results.  If you don't have a need for three states (Critical, Warning, Healthy), there is a Two State Monitor that can be used for this.

 

 

 

Create a new Monitor, select Scripting\Generic\Timed Script Three State Monitor

 

 

 

 

 

Give it a name, target, etc. (I targeted the Windows Computer class, but Windows Operating System may be a better choice).  I try to make a habit of unchecking "Monitor is enabled" and enabling it with an override later....at least while testing it:

 

 

 

 

 

 

Set the schedule...this just depends on how quickly you want to know if the service gets changed:

 

 

 

 

Next, I used a basic VB script which accepts a service name as a parameter, queries WMI for the service, and puts the Service Name, State (Running, Stopped, etc.), and StartMode (Disabled, Manual, Automatic) into property bag values.  The full text of the script is below the screenshot:

 

 

 

 

---------------------------------------------------------------------------------------------------

 

Dim oAPI, oBag,strComputer
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
set oArgs=wscript.arguments
strComputer="."
ServName=oArgs(0)

Set namespace=GetObject("winmgmts:\\"& strComputer & "\root\cimv2")
set servinfo=namespace.ExecQuery("select * from win32_service where name =" & """" & servname & """")

for each objservice in servinfo

Call oBag.AddValue("ServiceName",ServName)
Call oBag.AddValue("State",objservice.State)
Call oBag.AddValue("StartMode",objservice.StartMode)
Call oAPI.Return(oBag)

next

---------------------------------------------------------------------------------------------------

For the script parameter, I just enter "ServiceName"....this will be replaced by an override later, or you can just enter your service name here:

Next, I set the "Unhealthy", "Degraded", and "Healthy" expressions for the monitor.  My goal is to set the state to Warning when the service is Stopped but NOT Disabled , Critical when it is NOT Stopped, and Healthy when it is Stopped AND Disabled.  I used the following expressions:

Unhealthy Expression:

Parameter Name: Property[@Name='State']

Operator: Does not equal

Value: Stopped

Degraded Expression:

Parameter Name: Property[@Name='StartMode']

Operator: Does not equal

Value: Disabled

 

AND

 

Parameter Name: Property[@Name='State']

Operator: Equals

Value: Stopped

 

 

 

Healthy Expression:

 

Parameter Name: Property[@Name='StartMode']

Operator: Equals

Value: Disabled

 

AND

 

Parameter Name: Property[@Name='State']

Operator: Equals

Value: Stopped

 

 

 

Next, I used the default settings for Health State, since they already match what I want to do:

Next, I configure the alert settings.  The settings in the screen shot below will generate a Warning alert when the monitor is in a Warning state (service is not Disabled), and a Critical alert when the monitor is in the Critical state (service is not Stopped).  The Alert Description will have the service name (using the ServiceName property created by the script):

Now that I have the monitor created, I need to enable it and set the Override for the Service Name:

I'm using the Alerter service for my test:

To test the monitor, I first set the Alerter service to Manual Startup and leave it stopped:

Then I verify that I get the Warning alert:

Health Explorer correctly shows the "Degraded" Warning state:

Now I want to test the Critical state, so I start the Alerter Service:

Now the alert is changed to Critical:

And Health Explorer shows the "Unhealthy" Critical state:

 

 

When I stop the service and disable it, the alert is auto-resolved and the state is changed back to Healthy:

 

 

 

 

 

 

I've attached my sample MP which includes the following monitors:

 

Service disabled and stopped - two-state monitor:

If the specified service is not Stopped AND Disabled, the computer will be put in a Warning state and a Warning alert will be generated.  When the service is stopped and disabled, the computer will be put in a Healthy state.

Service disabled and stopped - three-state monitor:

If the specified service is Stopped and is not Disabled, the computer will be put in a Warning state and a Warning alert will be generated.  If the specified service is not Stopped, the computer will be put in a critical state and a Critical alert will be generated.  When the service is stopped and disabled, the computer will be put in a Healthy state.

Usage:

Both monitors are targeted at the Windows Computer class and roll up to the Configuration Health.  Both monitors are disabled by default.  They are configured to check the service every 1 minute.  To enable one of the monitors, add an Override for the Computer or Group you wish to monitor and set the following Override parameters:

Enabled=True

Script Arguments = <Service Name>

 

 

Enjoy!!

 

Service.Monitor.MP.xml

%3CLINGO-SUB%20id%3D%22lingo-sub-365475%22%20slang%3D%22en-US%22%3EMonitoring%20a%20service%20for%20State%20and%20StartMode%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-365475%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3E%20First%20published%20on%20TECHNET%20on%20Aug%2009%2C%202008%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EI%20recently%20had%20a%20customer%20that%20wants%20to%20get%20an%20alert%20when%20a%20specific%20service%20is%20not%20Disabled%20and%2For%20not%20Stopped.%26nbsp%3B%20I%20used%20the%20following%20steps%20to%20accomplish%20this%20using%20a%20%22Timed%20Script%20Three%20State%20Monitor%22.%26nbsp%3B%20Even%20if%20you%20do%20not%20have%20this%20specific%20need%2C%20these%20steps%20can%20be%20used%20as%20a%20template%20for%20creating%20a%20monitor%20that%20uses%20a%20script%20to%20query%20WMI%20and%20change%20state%20or%20generate%20alerts%20based%20on%20the%20results.%26nbsp%3B%20If%20you%20don't%20have%20a%20need%20for%20three%20states%20(Critical%2C%20Warning%2C%20Healthy)%2C%20there%20is%20a%20Two%20State%20Monitor%20that%20can%20be%20used%20for%20this.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20a%20new%20Monitor%2C%20select%20Scripting%5CGeneric%5CTimed%20Script%20Three%20State%20Monitor%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20497px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86703iF9EF092A7833807D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%20id%3D%22scid%3A0767317B-992E-4b12-91E0-4F059A8CECA8%3A0cd5adb7-3e5b-4abe-a35b-5a927d5997d5%22%3ETechnorati%20Tags%3A%20%3CA%20href%3D%22http%3A%2F%2Ftechnorati.com%2Ftags%2FOperations%2520Manager%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20Operations%20Manager%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22http%3A%2F%2Ftechnorati.com%2Ftags%2Fmonitor%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20monitor%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22http%3A%2F%2Ftechnorati.com%2Ftags%2FThree-state%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20Three-state%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22http%3A%2F%2Ftechnorati.com%2Ftags%2FTwo-state%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20Two-state%20%3C%2FA%3E%20%2C%20%3CA%20href%3D%22http%3A%2F%2Ftechnorati.com%2Ftags%2Fservice%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20service%20%3C%2FA%3E%3C%2FDIV%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGive%20it%20a%20name%2C%20target%2C%20etc.%20(I%20targeted%20the%20Windows%20Computer%20class%2C%20but%20Windows%20Operating%20System%20may%20be%20a%20better%20choice).%26nbsp%3B%20I%20try%20to%20make%20a%20habit%20of%20unchecking%20%22Monitor%20is%20enabled%22%20and%20enabling%20it%20with%20an%20override%20later....at%20least%20while%20testing%20it%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20514px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86705iF463A13ADC7D5B74%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESet%20the%20schedule...this%20just%20depends%20on%20how%20quickly%20you%20want%20to%20know%20if%20the%20service%20gets%20changed%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20497px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86707iE731EA3B0614BAB4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENext%2C%20I%20used%20a%20basic%20VB%20script%20which%20accepts%20a%20service%20name%20as%20a%20parameter%2C%20queries%20WMI%20for%20the%20service%2C%20and%20puts%20the%20Service%20Name%2C%20State%20(Running%2C%20Stopped%2C%20etc.)%2C%20and%20StartMode%20(Disabled%2C%20Manual%2C%20Automatic)%20into%20property%20bag%20values.%26nbsp%3B%20The%20full%20text%20of%20the%20script%20is%20below%20the%20screenshot%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20496px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86709iDC244198EEC7C58D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E---------------------------------------------------------------------------------------------------%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDim%20oAPI%2C%20oBag%2CstrComputer%20%3CBR%20%2F%3ESet%20oAPI%20%3D%20CreateObject(%22MOM.ScriptAPI%22)%20%3CBR%20%2F%3ESet%20oBag%20%3D%20oAPI.CreatePropertyBag()%20%3CBR%20%2F%3Eset%20oArgs%3Dwscript.arguments%20%3CBR%20%2F%3EstrComputer%3D%22.%22%20%3CBR%20%2F%3EServName%3DoArgs(0)%3C%2FP%3E%0A%3CP%3ESet%20namespace%3DGetObject(%22winmgmts%3A%5C%5C%22%26amp%3B%20strComputer%20%26amp%3B%20%22%5Croot%5Ccimv2%22)%20%3CBR%20%2F%3Eset%20servinfo%3Dnamespace.ExecQuery(%22select%20*%20from%20win32_service%20where%20name%20%3D%22%20%26amp%3B%20%22%22%22%22%20%26amp%3B%20servname%20%26amp%3B%20%22%22%22%22)%3C%2FP%3E%0A%3CP%3Efor%20each%20objservice%20in%20servinfo%3C%2FP%3E%0A%3CP%3ECall%20oBag.AddValue(%22ServiceName%22%2CServName)%20%3CBR%20%2F%3ECall%20oBag.AddValue(%22State%22%2Cobjservice.State)%20%3CBR%20%2F%3ECall%20oBag.AddValue(%22StartMode%22%2Cobjservice.StartMode)%20%3CBR%20%2F%3ECall%20oAPI.Return(oBag)%3C%2FP%3E%0A%3CP%3Enext%3C%2FP%3E%0A%3CP%3E---------------------------------------------------------------------------------------------------%3C%2FP%3E%0A%3CP%3EFor%20the%20script%20parameter%2C%20I%20just%20enter%20%22ServiceName%22....this%20will%20be%20replaced%20by%20an%20override%20later%2C%20or%20you%20can%20just%20enter%20your%20service%20name%20here%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20519px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86711iA59C2B194AB07CFF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENext%2C%20I%20set%20the%20%22Unhealthy%22%2C%20%22Degraded%22%2C%20and%20%22Healthy%22%20expressions%20for%20the%20monitor.%26nbsp%3B%20My%20goal%20is%20to%20set%20the%20state%20to%20Warning%20when%20the%20service%20is%20Stopped%20but%20NOT%20Disabled%20%2C%20Critical%20when%20it%20is%20NOT%20Stopped%2C%20and%20Healthy%20when%20it%20is%20Stopped%20AND%20Disabled.%26nbsp%3B%20I%20used%20the%20following%20expressions%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Unhealthy%20Expression%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EParameter%20Name%3A%20%3C%2FSTRONG%3E%20Property%5B%40Name%3D'State'%5D%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOperator%3A%20%3C%2FSTRONG%3E%20Does%20not%20equal%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EValue%3A%20%3C%2FSTRONG%3E%20Stopped%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Degraded%20Expression%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EParameter%20Name%3A%20%3C%2FSTRONG%3E%20Property%5B%40Name%3D'StartMode'%5D%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOperator%3A%20%3C%2FSTRONG%3E%20Does%20not%20equal%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EValue%3A%20%3C%2FSTRONG%3E%20Disabled%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20AND%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EParameter%20Name%3A%20%3C%2FSTRONG%3E%20Property%5B%40Name%3D'State'%5D%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOperator%3A%20%3C%2FSTRONG%3E%20Equals%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EValue%3A%20%3C%2FSTRONG%3E%20Stopped%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Healthy%20Expression%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EParameter%20Name%3A%20%3C%2FSTRONG%3E%20Property%5B%40Name%3D'StartMode'%5D%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOperator%3A%20%3C%2FSTRONG%3E%20Equals%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EValue%3A%20%3C%2FSTRONG%3E%20Disabled%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20AND%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EParameter%20Name%3A%20%3C%2FSTRONG%3E%20Property%5B%40Name%3D'State'%5D%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EOperator%3A%20%3C%2FSTRONG%3E%20Equals%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EValue%3A%20%3C%2FSTRONG%3E%20Stopped%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20522px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86712iEF5200F32AF88545%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20514px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86714iD54E5A372617D083%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20516px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86715iFAE3B634186CA977%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENext%2C%20I%20used%20the%20default%20settings%20for%20Health%20State%2C%20since%20they%20already%20match%20what%20I%20want%20to%20do%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20521px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86716i291DB76480008440%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENext%2C%20I%20configure%20the%20alert%20settings.%26nbsp%3B%20The%20settings%20in%20the%20screen%20shot%20below%20will%20generate%20a%20Warning%20alert%20when%20the%20monitor%20is%20in%20a%20Warning%20state%20(service%20is%20not%20Disabled)%2C%20and%20a%20Critical%20alert%20when%20the%20monitor%20is%20in%20the%20Critical%20state%20(service%20is%20not%20Stopped).%26nbsp%3B%20The%20Alert%20Description%20will%20have%20the%20service%20name%20(using%20the%20ServiceName%20property%20created%20by%20the%20script)%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20516px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86717iCFF931665C6A17B6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENow%20that%20I%20have%20the%20monitor%20created%2C%20I%20need%20to%20enable%20it%20and%20set%20the%20Override%20for%20the%20Service%20Name%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86719i0BD9DA99F87A6C2B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EI'm%20using%20the%20Alerter%20service%20for%20my%20test%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20472px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86720i062DE2EB3E7D6469%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETo%20test%20the%20monitor%2C%20I%20first%20set%20the%20Alerter%20service%20to%20Manual%20Startup%20and%20leave%20it%20stopped%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86721iAFEE416089D19F5D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThen%20I%20verify%20that%20I%20get%20the%20Warning%20alert%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86723i949F7B52B8275F68%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EHealth%20Explorer%20correctly%20shows%20the%20%22Degraded%22%20Warning%20state%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86725iAA73859AD4676E00%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENow%20I%20want%20to%20test%20the%20Critical%20state%2C%20so%20I%20start%20the%20Alerter%20Service%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86727iEC5B058464E07C69%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ENow%20the%20alert%20is%20changed%20to%20Critical%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86729iC973893955AA7858%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EAnd%20Health%20Explorer%20shows%20the%20%22Unhealthy%22%20Critical%20state%3A%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86730i0766A9AAD1887A3E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20I%20stop%20the%20service%20and%20disable%20it%2C%20the%20alert%20is%20auto-resolved%20and%20the%20state%20is%20changed%20back%20to%20Healthy%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20644px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F86731i6083404E42972B53%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI've%20attached%20my%20sample%20MP%20which%20includes%20the%20following%20monitors%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Service%20disabled%20and%20stopped%20-%20two-state%20monitor%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIf%20the%20specified%20service%20is%20not%20Stopped%20AND%20Disabled%2C%20the%20computer%20will%20be%20put%20in%20a%20Warning%20state%20and%20a%20Warning%20alert%20will%20be%20generated.%26nbsp%3B%20When%20the%20service%20is%20stopped%20and%20disabled%2C%20the%20computer%20will%20be%20put%20in%20a%20Healthy%20state.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Service%20disabled%20and%20stopped%20-%20three-state%20monitor%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EIf%20the%20specified%20service%20is%20Stopped%20and%20is%20not%20Disabled%2C%20the%20computer%20will%20be%20put%20in%20a%20Warning%20state%20and%20a%20Warning%20alert%20will%20be%20generated.%26nbsp%3B%20If%20the%20specified%20service%20is%20not%20Stopped%2C%20the%20computer%20will%20be%20put%20in%20a%20critical%20state%20and%20a%20Critical%20alert%20will%20be%20generated.%26nbsp%3B%20When%20the%20service%20is%20stopped%20and%20disabled%2C%20the%20computer%20will%20be%20put%20in%20a%20Healthy%20state.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Usage%3A%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EBoth%20monitors%20are%20targeted%20at%20the%20Windows%20Computer%20class%20and%20roll%20up%20to%20the%20Configuration%20Health.%26nbsp%3B%20Both%20monitors%20are%20disabled%20by%20default.%26nbsp%3B%20They%20are%20configured%20to%20check%20the%20service%20every%201%20minute.%26nbsp%3B%20To%20enable%20one%20of%20the%20monitors%2C%20add%20an%20Override%20for%20the%20Computer%20or%20Group%20you%20wish%20to%20monitor%20and%20set%20the%20following%20Override%20parameters%3A%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Enabled%3DTrue%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%20Script%20Arguments%20%3D%20%3CSERVICE%20name%3D%22%22%3E%20%3C%2FSERVICE%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnjoy!!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fmsdnshared.blob.core.windows.net%2Fmedia%2FTNBlogsFS%2Fprod.evol.blogs.technet.com%2Ftelligent.evolution.components.attachments%2F01%2F6699%2F00%2F00%2F03%2F10%2F30%2F36%2FService.Monitor.MP.xml%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%20Service.Monitor.MP.xml%20%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-365475%22%20slang%3D%22en-US%22%3E%3CP%3EFirst%20published%20on%20TECHNET%20on%20Aug%2009%2C%202008%20I%20recently%20had%20a%20customer%20that%20wants%20to%20get%20an%20alert%20when%20a%20specific%20service%20is%20not%20Disabled%20and%2For%20not%20Stopped.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-365475%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EJimmyHarper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Feb 20 2020 10:35 AM
Updated by: