Quantcast
Channel: THWACK: All Content - Server & Application Monitor
Viewing all articles
Browse latest Browse all 12281

Editing a 'Windows Script Monitor' Component Monitor to exlude services.

$
0
0

Hi

 

I'm a n00b with NCM and have been tasked with tidying up some of the alerts we have for 'Applications with Problems' on our NCM Orion Web Interface.

 

I couldn't figure out how to remove the 'Sophos Web Intelligence' Service which was showing as down on multiple servers in our estate. This service starts on demand and therefore always shows as down. I raised a call with Solarwinds for advice and the helpful support engineer advised me as follows;

 

'1. The component monitor being used in this particular case is a Windows Script Monitor.  In order to exclude Sophos from the monitoring of this component the script would have to be modified.  The script is an old one from the thwack community and may not be the best way to accomplish the type of monitoring you are looking for.'


He recommended the use of Windows Service Monitors instead which I will entertain but I thought it would be less work PERHAPS if there is anyone out there who can advise me how to code an exclusion into our script please?


The script is as follows;

 

'==========================================================================

 

'

 

' VBScript Source File -- Created with SAPIEN Technologies PrimalScript 3.1

 

'

 

' NAME: ServiceMonitorAPM1.vbs

 

'

 

' AUTHOR: Bob McDermand, State of Wa , DIS

 

' DATE  : 20091002

 

'

 

' COMMENT: For use with APM monitoring template, credit to Solarwinds for "borrowed"

 

' logic.

 

'

 

'

 

'==========================================================================

 

 

 

Option Explicit

 

Const SUCCESS = 0, FAIL = 1, wbemFlagReturnImmediately = &h10, wbemFlagForwardOnly = &h20

 

Dim strComputer, strUser, strPassword, sCount, strServiceList, objItem, colItems, objSWbemLocator, objSWbemServices

 

Dim objArgs

 

Set objArgs = WScript.Arguments

 

'Use the following syntax for Script Arguments field in APM Monitor script:

 

'${IP} ${USER} ${PASSWORD}

 

 

 

strComputer = objArgs(0)

 

strUser = objArgs(1)

 

strPassword = objArgs(2)

 

 

 

Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")

 

Set objSWbemServices = objSWbemLocator.ConnectServer _

 

                                (strComputer, "root\cimv2", strUser, strPassword)

 

                objSWbemServices.Security_.ImpersonationLevel = 3

 

Set colItems = objSWbemServices.ExecQuery("SELECT * FROM Win32_Service where StartMode = 'Auto' and State = 'Stopped'", "WQL", _

 

                                wbemFlagReturnImmediately + wbemFlagForwardOnly)

 

 

 

sCount=0

 

For Each objItem In colItems

 

                Select Case objItem.Name

 

                                'If a service name is listed in the following Case statement, it will be ignored.

 

                                'The service name is case sensitive and must be an exact match.

 

                                Case "SysmonLog"

 

                                Case Else

 

                                                If sCount=0 Then

 

                                                                strServiceList = objItem.DisplayName

 

                                                Else

 

                                                                strServiceList = strServiceList & ", " & objItem.DisplayName

 

                                                End If

 

                                                sCount = sCount + 1

 

                End Select

 

Next

 

 

 

If sCount > 0 Then

 

                WScript.Echo "Message: Auto Start Services Down: " & strServiceList

 

                WScript.Echo "Statistic: " & CStr(sCount)

 

                WScript.Quit(SUCCESS)

 

Else

 

                WScript.Echo "Message: All Auto Start Services Are Up"

 

                WScript.Echo "Statistic: 0"

 

                WScript.Quit(SUCCESS)

 

End If

 

 


Viewing all articles
Browse latest Browse all 12281

Trending Articles