Getting SWbemServicesEx: Not found error

  • Thread starter Thread starter Zach 25
  • Start date Start date
Z

Zach 25

Guest
Hey Guys

I am not a VB guy and not sure what to fix in the script. I got this script from internet to monitor my IIS Apppools. The script was working in my old nagios environment but we updated our Nagios and this script got crashed (I believed). Right now, i am getting this error ****(34, 1) SWbemServicesEx: Not found ***** I dont understand is that really nagios problem, script problem, IIS problem, or any windows service problem. please have a look and let me know what line or command in the script should be fixed.


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

Args
numargs = WScript.Arguments.Unnamed.length - 1
for i = 1 to numargs
WScript.Echo(" " + WScript.Arguments.Unnamed.Item(i))
strArgAppPool = strArgAppPool & " " & WScript.Arguments.Unnamed.Item(i)
next

strArgAppPool = Wscript.Arguments.Unnamed.Item(0)
Const noError = False

Establish the connection to the WMI provider
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")

Search the AppPool passed as argument in the list of application pools
Set oAppPool = oWebAdmin.Get("ApplicationPool.Name=" & strArgAppPool & "")

Create nice messages for pool states
Select Case oAppPool.GetState

Case 0
StateDescription = "STARTING"
outputStatus = "WARNING! "
outputCode = 1
Case 1
StateDescription = "STARTED"
outputStatus = "OK! "
outputCode = 0
Case 2
StateDescription = "STOPPING"
outputStatus = "WARNING! "
outputCode = 1
Case 3
StateDescription = "STOPPED"
outputStatus = "CRITICAL!! "
outputCode = 2
Case 4
StateDescription = "UNKNOWN"
outputStatus = "UNKNOWN? "
outputCode = 3
Case Else
StateDescription = "UNDEFINED VALUE"
outputStatus = "UNKNOWN? "
outputCode = 3

End Select

Output
Wscript.Echo outputStatus & oAppPool.Name & ": " & StateDescription

Error handling
If noError = true Then
Error message
Wscript.echo "UNKNOWN: Error during the WMI query for app pool " & strArgAppPool & " !"
Exit & return code
WScript.Quit(3)
Else
Clean exit
WScript.Quit(outputCode)
End If

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

Continue reading...
 
Back
Top