Ad Widget

Collapse

WMI supportq

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sosher
    Junior Member
    • Jun 2006
    • 12

    #1

    WMI supportq

    hello all...

    when can we expect support if at all, for wmi ?
    This protocol Exposes many item the can be of use for a NMS.

    Thanks
  • erisan500
    Senior Member
    Zabbix Certified Specialist
    • Aug 2005
    • 285

    #2
    WMI is already supported through custom scripts.

    Post an example of a WMI query and we'll show you how to use that as an item in zabbix.

    Greetings
    EriSan
    Zabbix Certified Specialist

    Comment

    • sosher
      Junior Member
      • Jun 2006
      • 12

      #3
      Hi,
      Thanks Erisan , Again

      here is a small script
      --script--
      On Error Resume Next
      strComputer = "."
      Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
      Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
      For Each objItem in colItems
      Wscript.Echo "UserName: " & objItem.UserName
      Next
      -- end of script--
      Its purpose to bring the current logged on user ...

      Comment

      • erisan500
        Senior Member
        Zabbix Certified Specialist
        • Aug 2005
        • 285

        #4
        I modified your script a bit:

        Code:
        On Error Resume Next
        strComputer = "."
        Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
        For Each objItem in colItems
        WScript.StdOut.Write objItem.UserName
        Next
        PS. Do not use Wscript.echo as that adds a CR to the output and Zabbix doens't like that.

        Save this script as C:\myscript.vbs

        Now, in your agent config file add a user parameter like:

        UserParameter=myUserName,c:\myscript.vbs

        Then add an item to the right host with key "myUserName"

        Have fun !!

        Greetings
        Last edited by erisan500; 19-08-2006, 21:56.
        EriSan
        Zabbix Certified Specialist

        Comment

        • dantheman
          Senior Member
          • May 2006
          • 209

          #5
          You can actually do this without adding a custom parameter to each agent, add an item for that host with the key
          Code:
          system.run[c:\mycode.vbs]
          And you'll accomplish the same thing.

          Comment

          Working...