News:

We really need your input in this questionnaire

Main Menu

WMI Queries

Started by toad, June 12, 2008, 10:28:35 AM

Previous topic - Next topic

toad

I am impressed with Netxms, especially the fact the data is stored in SQL which allows for a simple to use data collector.

A few days have been spent on getting SNMP queries to a MS-SQL 2005 system working when I found a webpage showing that Microsoft no longer support SNMP queries to SQL 2005 .... so that leaves WMI to perform the checks.

I see that Netxms has a "Generic WMI Query" option within the agent, but I do not see any information on how to use this feature.

Has anyone done WMI queries on SQL and/or other Windows performance settings? If so how is this done.

Alex Kirhenshtein

Hello.

You need to load "wmi" subagent (add "SubAgent = wmi.nsm" to your nxagentd.conf), this will add "WMI.Query()" parameter to the agent.
This parameter takes two arguments: namespace and query string.

Sample:

nxget SERVER_IP '"WMI.Query('root\WMI', 'SELECT InstanceName,CurrentTemperature FROM MSAcpi_ThermalZoneTemperature')"


I have no experience with querying MSSQL status using WMI, but according to google you can do something like this:

nxget SERVER_IP "WMI.Query('root\Microsoft\SqlServer\ComputerManagement', 'SELECT State FROM SqlService')"




Victor Kirhenshtein

Hi!

Actually, WMI.Query(*) gets three parameters - namespace, query string, and property name. For example, to get CPU information, you can use the following parameter:


WMI.Query(root\CIMV2,SELECT * FROM Win32_Processor,Name)


Best regards,
Victor

Anth0ny

#3
can't get it to work =(

nxget.exe 192.168.0.1 -a "none" -K "c:\netxms\var\server_key" "WMI.Query(root\CIMV2,SELECT * FROM Win32_Processor,Name)"

or

nxget.exe 192.168.0.1 -a none -K c:\netxms\var\server_key "WMI.Query('root\WMI', 'SELECT InstanceName,CurrentTemperature FROM MSAcpi_ThermalZoneTemperature')"

always have:

500: Internal error

Victor Kirhenshtein

Is WMI service running? Is there any WMI-related messages in agent's log? Also, if start agent in debug mode (by adding -D switch), it will produce additional diagnostics.

Anth0ny

Thanks!

Will test it today.

Anth0ny

WMI service at nodes has tested: all works fine.
But still have Error 500.

Can problem be with mismatched permissions? I mean can it be if "Local System" account haven't appropriate rights for querying to WMI interface?

Anth0ny

#7
question about nxget: is it something like SNMP GET?
and i can get only one value, but can't get the list?

looks like an SNMP commands: "get" and "walk".

is it possible to do "walk" with nxget.exe for query lists of available values form nodes?

Your test query: WMI.Query(root\CIMV2,SELECT * FROM Win32_Processor,Name) - it works for me! =)

Please, need more information about syntax (root\CIMV2,SELECT * FROM Win32_Processor,Name): what is red-lighted parameter and how about other parameters?

I need to execute this queries, but i can't to do it (always have "500 internal error")

select DatabaseNodeMemory from Win32_PerfFormattedData_DNS_DNS
select DynamicUpdateQueued from Win32_PerfFormattedData_DNS_DNS
select TotalQueryReceived from Win32_PerfFormattedData_DNS_DNS
select TotalResponseSent from Win32_PerfFormattedData_DNS_DNS

Luiz A. Camilo

I know that the post is old, But I just want to report what I found in case it helps someone else when searching on this fórum.
Please let me know if is there a better way to do this.

I found that Dell Servers have a particular way to interact with ACPI on this fórum : http://forums13.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1307729003111+28353475&threadId=940582

So I made the following query using NetXMS agent :

WMI.Query(root\CIMV2\dell, SELECT * FROM CIM_TemperatureSensor where DeviceID=2, CurrentReading)

It works perfectly to me as the DeviceID 2 is the "BMC Ambient Temp Sensor" wich gives me better values (only 2 degrees of difference) like if the room temperature is around 25 Celcius, this sensor gives me the value of 270.

Also for those who want to explore WMI, I recommend 2 tools. One is Windows native called Wbemtest.exe (C:\windows\system32\wbem) and the other you have to download and is called "WMI Administrative Tools" http://www.microsoft.com/downloads/en/details.aspx?familyid=6430f853-1120-48db-8cc5-f2abdc3ed314

Thanks.