Is anyone aware of a way to poll for a service that is in a hung state as opposed to stopped?
If not I might try to make a script for this
Hi There VGaudio--
I have two links I believe will help you. Check them out and post back with your findings!
Here's what I came up with so far. Tested on a 'hung' service (that I can't stop) and it reported it as 'Degraded'
What I'm wondering now is if I can set up my e-mail alert that's triggered with the echo message that comes through to APM, i.e. "All services stable" - I'd like to insert the status message into the e-mail. Is this possible?
Also, I'm using a loop to catch all of the hung services and send a message back for each- I'm guessing the loop isn't necessary since I believe only 1 message gets returned to APM (first or last message? not sure, maybe someone knows). My error catching is sloppy as well - this is dirty at the moment but it works fine if you tweak your credential sets until the permission errors go away and the script is polling cleanly.
*********************************************************************
On Error Resume NextstrComputer = "THE_REMOTE_IP_ADDRESS"Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")if Err.Number <> 0 then wscript.echo "Message: Error: " & Err.Description Wscript.Echo "Statistic: 1" wscript.quit(1)end ifSet colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Status <> 'OK'")if Err.Number <> 0 then wscript.echo "Message: Error: " & Err.Description Wscript.Echo "Statistic: 1" wscript.quit(1)end ifif colListOfServices.Count = 0 then Wscript.Echo "Message: All services stable" Wscript.Echo "Statistic: 0" Wscript.quit(0)else for each objService in colListOfServices Wscript.Echo "Message: Service " & objService.DisplayName & " is " & objService.Status next Wscript.Echo "Statistic: 1" Wscript.quit(1)end if
Hi, vg.
There are a number of macros you can put into your alert email that are described in the admin guide in the "Orion APM Alerts" topic.
The one you want to report the status of components is: ${StatusOrErrorDescription}
There's a table full of other macros in that topic that you might also find handy.
Thanks, but ${StatusOrErrorDescription} is coming out as '${StatusOrErrorDescription}'
I'll check the guide tomorrow to find the appropriate variable if noone knows what's wrong with this one.