NetXMS Support Forum

English Support => General Support => Topic started by: LeapfrogIT on November 17, 2008, 04:51:30 PM

Title: WMI Query filtering
Post by: LeapfrogIT on November 17, 2008, 04:51:30 PM

Is it possible to use more complex wmi queries ad DCI's ?

For example something like

WMI.Query(root\CIMV2,select * FROM Win32_Service WHERE Name = 'ApacheTomcatApplicationServer',status)

Thankyou to any assistance some can provide


kindest regards

Title: Re: WMI Query filtering
Post by: Victor Kirhenshtein on November 18, 2008, 09:43:29 PM
Hi!

Yes, it shoulod be possible. WMI subagent will accept any valid WMI queries.

Best regards,
Victor
Title: Re: WMI Query filtering
Post by: LeapfrogIT on November 19, 2008, 12:54:17 AM
excellent :) that certainly opens up the queries I can run.


Now I know that I can go back degugging my WQL queries themselfs will add them to Toads Pinned list once I have a decent number of queries made up. Like with most of these things it will probably be the first querie that takes some time afterthat I should be able to duplicate the priciples nice and easly :)


Title: Re: WMI Query filtering
Post by: LeapfrogIT on November 19, 2008, 05:40:05 AM
Sorry to be a bother , but I am really having a hard time getting this to work for me

As an example , I am trying to run

WMI.Query(root\CIMV2,select * FROM Win32_Service WHERE Name = 'WsusService', Status)

When I use scriptomatic or WMI Query tester it works fine giving the resullt that I expect  however Netxms Console tells me that it's an unsupported DCI , and when I try and run it via nxget i get an internal server 500 error .

Could this possibly be an extention of the current WMI.nsm bug for 2.22 ?  I was seing similar signs happening when I first installed 2.22 without upgrading the wmi part of the agent to the 2.23 rc release
Title: Re: WMI Query filtering
Post by: Victor Kirhenshtein on November 19, 2008, 12:01:03 PM
Hi!

You should enclose query string in double quotes, because otherwise NetXMS agent incorrectly interprets single quotes within query. Correct syntax for parameter will be following:

WMI.Query(root\CIMV2,"select * FROM Win32_Service WHERE Name = 'WsusService'", Status)

Best regards,
Victor
Title: Re: WMI Query filtering
Post by: LeapfrogIT on November 19, 2008, 02:03:37 PM
That worked perfectly thankyou victor :)
Title: Re: WMI Query filtering
Post by: Anth0ny on November 19, 2008, 02:41:24 PM
How can i use it at command prompt (for testing purposes)?

Is it right?

nxget host_ip WMI.Query(root\CIMV2,"select * FROM Win32_Service WHERE Name = 'WsusService'", Status)
Title: Re: WMI Query filtering
Post by: Victor Kirhenshtein on November 19, 2008, 03:17:24 PM
Correct command line on Windows:

nxget host_ip "WMI.Query(root\CIMV2,\"select * FROM Win32_Service WHERE Name = 'WsusService'\", Status)"

on UNIX:
nxget host_ip "WMI.Query(root\\CIMV2,\"select * FROM Win32_Service WHERE Name = 'WsusService'\", Status)"

Best regards,
Victor
Title: Re: WMI Query filtering
Post by: Anth0ny on November 19, 2008, 04:38:26 PM
Victor, thanks! =)