Changeset 34e7428 in nscp for modules/CheckWMI/WMIQuery.cpp


Ignore:
Timestamp:
07/01/08 06:39:49 (5 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
da1c7e1
Parents:
a720da5
Message:

Added new option (namespace) to CheckWMI and CheckWMIValue use like so:

CheckWMI namespace=root
cimv2 MaxCrit=3 MinWarn=1 "Query:load=Select * from win32_Processor"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/CheckWMI/WMIQuery.cpp

    rdff5db9 r34e7428  
    3636} 
    3737 
    38 WMIQuery::result_type WMIQuery::execute(std::wstring query) 
     38WMIQuery::result_type WMIQuery::execute(std::wstring ns, std::wstring query) 
    3939{ 
    4040  result_type ret; 
     
    4646  } 
    4747 
    48   BSTR bstrNamespace = (_T("root\\cimv2")); 
     48  CComBSTR strNamespace(ns.c_str()); 
    4949  CComPtr< IWbemServices > service; 
    50   hr = locator->ConnectServer( bstrNamespace, NULL, NULL, NULL, WBEM_FLAG_CONNECT_USE_MAX_WAIT, NULL, NULL, &service ); 
     50  hr = locator->ConnectServer( strNamespace, NULL, NULL, NULL, WBEM_FLAG_CONNECT_USE_MAX_WAIT, NULL, NULL, &service ); 
    5151  if (FAILED(hr)) { 
    5252    throw WMIException(_T("ConnectServer failed!"), hr); 
Note: See TracChangeset for help on using the changeset viewer.