Ad Widget

Collapse

ZBX_NOTSUPPORTED using CheckServiceStatus

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shadowfayre
    Junior Member
    • Mar 2007
    • 8

    #1

    ZBX_NOTSUPPORTED using CheckServiceStatus

    I created an item based on the forum information on services. (modifying the .conf and create a CheckServiceStatus.vbs script. Everything I can find appears to be correct; but I am receiving the ZBX_NOTSUPPORTED error and eventually the status changes to NOT_SUPPORTED under the items.

    '-----------------------------------------------------------------------
    'CheckServiceStatus.vbs
    '-----------------------------------------------------------------------
    set args = WScript.Arguments
    num = args.Count

    if num = 0 then
    WScript.Echo "Usage: [CScript | WScript] CheckServiceStatus.vbs <computername> <servicename>"
    WScript.Quit 1
    end If

    computername = args.Item(0)
    servicename = args.Item(1)

    wscript.stdout.write GetService(computername, servicename)

    Function GetService(strComputer, strSrvce)

    On Error Resume Next

    Dim objWMIService
    Dim colListOfServices
    Dim objService

    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colListOfServices = objWMIService.ExecQuery _
    ("Select DisplayName,State from Win32_Service Where Name = '" & strSrvce & "'")

    If Err.Number <> 0 Then
    GetService = "Stopped"
    Err.Clear
    Else
    For Each objService in colListOfServices
    GetService = "Running"
    strState = objService.State
    Next
    End If

    End Function


    UserParameter=svc-Spooler,cscript.exe c:\CheckServiceStatus.vbs <myservername> Spooler //nologo

    Description Windows Services - Print Spooler
    Type (tried agent and agent live)
    Key svr-Spooler
    Type of information
    Update interval (in sec) 30
    Keep history (in days) 10
    Keep trends (in days) 365
    Status monitored


    Cannot seem for the life of me to figure out why it is not working. Windows 2000 Server. Please advise. Thanks,
Working...