Ticket #197 (reopened defect)

Opened 4 years ago

Last modified 17 months ago

CheckWMI namespace option not working

Reported by: cmoore@… Owned by: mickem
Priority: 1 Milestone: 0.3.6
Component: CheckWMI Version: 0.3.8
Severity: Bugs Keywords: namespace CheckWMI 2003 SBS
Cc: woodstock

Description

I have nscp 0.3.3 32bit (which is not listed as a valid version in the Trac ticket system) installed on Windows Server 2003 R2, and I can't seem to get the namespace option to work. Here's the command I am testing with:

CheckWMI MaxCrit=3 MinWarn=1 "Query=SELECT * FROM win32_Processor" namespace=root\\cimv2

If I run that without the namespace option, it works fine. I trying to test a command I know works because the command I really want to run is in another namespace:

CheckWMI MaxCrit=3 MinWarn=1
  "Query=SELECT MessageCount FROM Exchange_SMTPQueue WHERE LinkName=PostDSNGenerationQueue"
  namespace=root\\MicrosoftExchangeV2

I've tried the following namespaces, and none of them work (I also tried doubling up the backslashes too):

root\\cimv2
\\\\.\\root\\cimv2
\\\\servername\\root\\cimv2

Here's the debug output form nscp:

d \NSClient++.cpp(541) Injecting: CheckWMI: MaxCrit=3, MinWarn=1,
  Query=Select *  from win32_Processor, namespace=root\\cimv2
d \NSClient++.cpp(561) Injected Result: CRITICAL 'WMIQuery failed:
  ConnectServer  failed!:failed to lookup error code: 2147749902( reson: 317)'
d \NSClient++.cpp(562) Injected Performance Result: ''

Change History

comment:1 Changed 4 years ago by mickem

  • Status changed from new to closed
  • Resolution set to fixed

fixed in the new nightly (out in a few minutes)

MickeM

comment:2 Changed 4 years ago by nlshep@…

  • Status changed from closed to reopened
  • Version changed from 0.3.2 to 0.3.3
  • Resolution fixed deleted

I've updated to the 20080704-0712 nightly build, but namespaces still don't work for me. I did not restart the system between uninstalling the older version and installing the newer one, but I did stop and start the nsclientpp service appropriately.

Output of my testing:

C:\Program Files\NSClient++>"nsclient++.exe" -about
l \NSClient++.cpp(100) NSClient++ (C) Michael Medin
l \NSClient++.cpp(101) Version 0.3.3.25 2008-07-04

C:\Program Files\NSClient++>"nsclient++.exe" CheckWMI "select * from win32_Processor"
d \NSClient++.cpp(426) Loading plugin: CheckDisk...
d \NSClient++.cpp(426) Loading plugin: Event log Checker....
d \NSClient++.cpp(426) Loading plugin: Helper function...
d \NSClient++.cpp(426) Loading plugin: CheckSystem...
d \NSClient++.cpp(426) Loading plugin: CheckWMI...
d \PDHCollector.cpp(66) Autodetected w2k or later, using w2k PDH counters.
d \NSClient++.cpp(426) Loading plugin: File logger...
d \PDHCollector.cpp(103) Using index to retrive counternames
d \NSClient++.cpp(426) Loading plugin: NRPE server...
d \PDHCollector.cpp(123) Found countername: CPU:    \Processor(_total)\% Processor Time
d \PDHCollector.cpp(124) Found countername: UPTIME: \System\System Up Time
d \PDHCollector.cpp(125) Found countername: MCL:    \Memory\Commit Limit
d \PDHCollector.cpp(126) Found countername: MCB:    \Memory\Committed Bytes
d \NSClient++.cpp(334) Found module: CheckWMI...
d \Socket.h(630) Bound to: 0.0.0.0:5666
l \CheckWMI.cpp(301) |--------------+--------------+--------------+...
l \CheckWMI.cpp(302) | AddressWidth | Architecture | Availability |...
l \CheckWMI.cpp(303) |--------------+--------------+--------------+...
l \CheckWMI.cpp(312) |           32 |            0 |            3 |...
l \CheckWMI.cpp(312) |           32 |            0 |            3 |...
l \CheckWMI.cpp(312) |           32 |            0 |            3 |...
l \CheckWMI.cpp(312) |           32 |            0 |            3 |...
l \CheckWMI.cpp(314) |--------------+--------------+--------------+...
d \NSClient++.cpp(400) Unloading plugin: NRPE server...
d \Socket.h(664) Socket listener is preparing to shutdown...
e \NRPEListener.cpp(150) Exception caught: Error: SSL Context already initalized.
d \NSClient++.cpp(400) Unloading plugin: File logger...
d \NSClient++.cpp(400) Unloading plugin: CheckWMI...
d \NSClient++.cpp(400) Unloading plugin: CheckSystem...
d \NSClient++.cpp(400) Unloading plugin: Helper function...
d \NSClient++.cpp(400) Unloading plugin: Event log Checker....
d \NSClient++.cpp(400) Unloading plugin: CheckDisk...

C:\Program Files\NSClient++>"nsclient++.exe" CheckWMI namespace=root\\cimv2 "select * from win32_Processor"
d \NSClient++.cpp(426) Loading plugin: CheckDisk...
d \NSClient++.cpp(426) Loading plugin: Event log Checker....
d \NSClient++.cpp(426) Loading plugin: Helper function...
d \NSClient++.cpp(426) Loading plugin: CheckSystem...
d \NSClient++.cpp(426) Loading plugin: CheckWMI...
d \PDHCollector.cpp(66) Autodetected w2k or later, using w2k PDH counters.
d \NSClient++.cpp(426) Loading plugin: File logger...
d \PDHCollector.cpp(103) Using index to retrive counternames
d \NSClient++.cpp(426) Loading plugin: NRPE server...
d \PDHCollector.cpp(123) Found countername: CPU:    \Processor(_total)\% Processor Time
d \PDHCollector.cpp(124) Found countername: UPTIME: \System\System Up Time
d \PDHCollector.cpp(125) Found countername: MCL:    \Memory\Commit Limit
d \PDHCollector.cpp(126) Found countername: MCB:    \Memory\Committed Bytes
d \NSClient++.cpp(334) Found module: CheckWMI...
d \Socket.h(630) Bound to: 0.0.0.0:5666
e \CheckWMI.cpp(271) WMIQuery failed: ExecQuery of 'namespace=root\\cimv2 select * from win32_Processor' fa
d \NSClient++.cpp(400) Unloading plugin: NRPE server...
d \Socket.h(664) Socket listener is preparing to shutdown...
e \NRPEListener.cpp(150) Exception caught: Error: SSL Context already initalized.
d \NSClient++.cpp(400) Unloading plugin: File logger...
d \NSClient++.cpp(400) Unloading plugin: CheckWMI...
d \NSClient++.cpp(400) Unloading plugin: CheckSystem...
d \NSClient++.cpp(400) Unloading plugin: Helper function...
d \NSClient++.cpp(400) Unloading plugin: Event log Checker....
d \NSClient++.cpp(400) Unloading plugin: CheckDisk...

comment:3 Changed 4 years ago by mickem

namespace does not work from the CLI (only from the check command) I was lazy so I never added a CLI option for setting it... will do...

MickeM

comment:4 follow-up: ↓ 5 Changed 3 years ago by User

  • Version 0.3.3 deleted
  • Milestone changed from 0.4.0 to 0.3.6

Hi,

same issue with the last version ( NSClient++-0.3.6-RC8 ) WMIQuery failed: CoCreateInstance? for CLSID_WbemAdministrativeLocator failed!:failed to lookup error code: 2147749908( reson: 317)

Same issue with and without the namespace option

comment:5 in reply to: ↑ 4 Changed 2 years ago by woodstock

  • Cc woodstock added
  • Keywords CheckWMI 2000 added
  • Version set to 0.3.7

Hi,

I have same issue than comment 6, with both version 0.3.6 and 0.3.7, but only when installed on Windows2000 Server. Same install and command works fine on Windows 2003.

D:\NSClient++>"nsclient++.exe" CheckWMI "select * from win32_Processor" d NSClient++.cpp(533) Attempting to start NSCLient++ - 0.3.7.493 2009-10-12 e \CheckWMI.cpp(290) WMIQuery failed: CoCreateInstance? for CLSID_WbemAdministrativeLocator failed!:failed to lookup error code: 2147749908( reson: 317)

Is CheckWMI not working on Windows2000 Server ?

NB: I dont't try the namespace keyword...

WoodS

comment:6 Changed 2 years ago by felimwhiteley

  • Keywords 2003 SBS added; 2000 removed

I'm getting the same/similar problem trying to access the root
HPQ namespace on proliant servers running OpenView?.

Version: 0.3.7.493 2009-10-12

Running the check_nrpe on another machine responds with

WMIQuery failed: ConnectServer failed!:failed to lookup error code: 2147749902( reson: 317)

Not sure if it is relevant but it is a Small Business Server version of 2003. I'll try get more details.

comment:7 Changed 2 years ago by mickem

Could you paste debug log from nsclient++ ?

Michael Medin

comment:8 Changed 2 years ago by felimwhiteley

Hi Michael,

Is the relevant section ok?

d NSClient++.cpp(1073) Injecting: CheckWMI: Query=SELECT Status  FROM HP_WinEthernetPortStatistics, columnSeparator=|, namespace=root\HPQ
d NSClient++.cpp(1109) Injected Result: CRITICAL 'WMIQuery failed: ConnectServer failed!:failed to lookup error code: 2147749902( reson: 317)'
d NSClient++.cpp(1110) Injected Performance Result: ''

The other thing that's odd is it continually pumping out:

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

Always the same message. Here's the rest of the debug (All I have done is obfuscated the servername and domain. It's a clients system so not sure they want it in public, despite being an internal only domain.

Launching test mode - client mode                             
d NSClient++.cpp(1145) Enabling debug mode...                 
d NSClient++.cpp(533) Attempting to start NSCLient++ - 0.3.7.493 2009-10-12
d NSClient++.cpp(936) Loading plugin: CheckDisk...                         
d NSClient++.cpp(936) Loading plugin: Event log Checker....                
d NSClient++.cpp(936) Loading plugin: Helper function...                   
d NSClient++.cpp(936) Loading plugin: CheckSystem...                       
d NSClient++.cpp(936) Loading plugin: CheckWMI...                          
d NSClient++.cpp(936) Loading plugin: File logger...                       
d \PDHCollector.cpp(66) Autodetected w2k or later, using w2k PDH counters. 
d \PDHCollector.cpp(103) Using index to retrive counternames               
l \FileLogger.cpp(93) Log path is: ?C \nsclient.log                        
d NSClient++.cpp(936) Loading plugin: NRPE server (w/ SSL)...              
d \NRPEListener.cpp(91) Loading all commands (from NRPE)                   
d \NRPEListener.cpp(121) Starting NRPE socket...                           
e \PDHCollector.cpp(133) Failed to open performance counters: RESOLVER: PdhLookupPerfNameByIndex: Could not find index: 6: -2147481648: Unable to connect to specified machine or machine is off line.                                                                                                

d \PDHCollector.cpp(169) We aparently failed to load counters trying to use default (English) counters or those configured in nsc.ini
d NSClient++.cpp(638) NSCLient++ - 0.3.7.493 2009-10-12 Started!                                                                     
l NSClient++.cpp(437) Using settings from: INI-file                                                                                  
l NSClient++.cpp(438) Enter command to inject or exit to terminate...                                                                
d \Socket.h(669) Bound to: 0.0.0.0:5666                                                                                              
e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.         

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

d NSClient++.cpp(1073) Injecting: CheckWMI: Query=SELECT Name, Domain FROM Win32_ComputerSystem, columnSeparator=|, namespace=root\cimv2
d \CheckWMI.cpp(139) No filters specified so we will match all rows                                                                     
d \CheckWMI.cpp(162) Message is: Domain=PlanningAid.lan|Name=PAS-SVR01                                                                  
d \checkHelpers.hpp(758) Missing bounds for maxmin-bounds check: wmi query                                                              
d NSClient++.cpp(1109) Injected Result: OK 'Domain=DomainName.lan|Name=SERVER01'                                                      
d NSClient++.cpp(1110) Injected Performance Result: ''wmi query'=1;0;0; '                                                               
e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.            

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

e \PDHCollector.cpp(208) Failed to query performance counters: PdhCollectQueryData failed: : -2147481643: No data to return.

comment:9 Changed 2 years ago by felimwhiteley

I've tried this same query on a full 2003 machine and it worked. I'm wondering is 2003 SBS is doing something strange?

comment:10 follow-up: ↓ 11 Changed 2 years ago by felimwhiteley

Checked on a few 2003 full editions and another few SBS boxes and the common denominator is Small Business Server.

comment:11 in reply to: ↑ 10 Changed 2 years ago by san

Replying to felimwhiteley:

Checked on a few 2003 full editions and another few SBS boxes and the common denominator is Small Business Server.

I can confirm the defect as well for
System: Windows XP Pro SP3 German
NSClient++ Version: 0.3.7.493 2009-10-12

While trying to access root
SecurityCenter? to read AntiVirusProduct? the following error is passed on to Nagios server (via nsca):

WMIQuery failed: ConnectServer failed!:failed to lookup error code: 2147749902( reson: 317)

Commandline in NSC.ini on client:

check_wintest=CheckWMI namespace="root\\SecurityCenter" Query="SELECT productUptoDate FROM AntiVirusProduct" ShowAll=long

*Lars

comment:12 Changed 17 months ago by Bambuti2000

  • Version changed from 0.3.7 to 0.3.8

Hi, I've the same problem on Windows 2000 Server without namespace.

WMIQuery failed: CoCreateInstance for CLSID_WbemAdministrativeLocator failed!:failed to lookup error code: 2147749908( reson: 317)

Is there any solution?

best regards Stefan

Note: See TracTickets for help on using tickets.