PDA

View Full Version : WMI supportq


sosher
16-08-2006, 13:50
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
18-08-2006, 20:24
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

sosher
19-08-2006, 20:36
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 ...

erisan500
19-08-2006, 21:03
I modified your script a bit:


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

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