Add Custom WMI Monitors

Tags:  

How to add custom WMI monitors into MSPCenterPlus

Disclaimer: This is a work around procedure. Trying these steps needs some basic knowledge about WMI queries. Please don't attempt it in live setup if you are not very sure of WMI as you might be messing around with some configuration files in the process.

 Steps to add WMI monitors into MSPCENTERPLUS

  1. Write down your WMI Query
  2. Test your WMI query from command prompt
  3. Execute db queries to add  the WMI monitor into the db
  4. Add the WMI monitor into template from the central UI
  5. Execute db queries to manipulate some values of the added monitor
  6. Associate the monitor to several devices and check if data is getting collected properly

Step1:  Write down your WMI query

example :
Select percentusage from Win32_PerfFormattedData_PerfOS_PagingFile where name ="_Total"

Step2: Test your WMI Query

Go to central or probe\conf\application\scripts\ and execute the query below

C:\Program Files\AdventNet\ME\probe\conf\application\scripts>cscript wmiget.vbs machinename "domainname\username" "password" ROOT\CIMV2 "SELECT percentusage FROM Win32_PerfFormattedData_PerfOS_PagingFile WHERE name ='_Total'"



Step 3: Execute the following queries in central and probe database
  1. select * from wmiclass where classname like "%put your class name here%"
  2. if the above query doesnt return any result then do the following, else get the classid from the above query and proceed to step 3
  3. select max(classid) from wmiclass
  4. insert into wmiclass set classid=XYZ,namespace='ROOT\\CIMV2',classname="Win32_PerfFormattedData_PerfOS_PagingFile"
  5. select max(collectdataid) from wmipolleddata
  6. insert into wmipolleddata set collectdataid="XYZ", collectdataname="PagingFile Usage", classid=46, Expression="percentusage", CRITERIA="name ='_Total'",instance=null

    * - XYZ  - increment the number obtained in earlier step and use here. For example if max(classid) is 45 use 46

Step 4: Go to central user interface and do the following
  1. Open central URL and go to Admin-> Monitoring Templates-> Windows Base WMI Template->New Monitor-> Add Bulk
  2. Provide the following info
    • name= PagingFile Usage
    • oid=PagingFile Usage
      *  - the OID should be the same as collectdataname in the insert query above
    • Tabular = no
    • Interval = 5 mins
    • Units = %
    • Thershold = provide if you wish
  3. Save the Template
  4. Cancel the final step

Step 5: Execute the following DB queries in both central and probe
  1. update graphdetails set protocolid=(select protocolid from protocoldetails where protocolname="WMI") where graphname like "%PagingFile%"
  2. select * from graphdetails where graphname like "%PagingFile%"
  3. insert into graphuserprops set graphid=XYZ,propname="GROUPNAME",propvalue="WMI"

    * - get the ID from the step above

Step 6: Apply the monitor to device

  • Go to the device snapshot page and add the monitor.
  • Do a test monitor and see if it shows the data correctly


Example 2:  PoolNonPagedBytes


WMI Query : select PoolNonpagedBytes from Win32_PerfFormattedData_PerfOS_Memory

Step1: Add the WMI class

Execute the following queries in your central database ....

check if the wmiclass is already present
  1. select * from wmiclass where classname like "%Win32_PerfFormattedData_PerfOS_Memory%"
add the wmicclass if it is not present
  1. select max(classid) from wmiclass
  2. insert into wmiclass set classid=x+1, namespace='ROOT\\CIMV2', classname="Win32_PerfFormattedData_PerfOS_Memory"

    note:  x = max(classid)
notedown the wmiclass id
  1. select classid from wmiclass where classname="Win32_PerfFormattedData_PerfOS_Memory"
will be used in next step as z
add wmimonitor
  1. select max(collectdataid) from wmipolleddata 
  2. insert into wmipolleddata set collectdataid="y+1", collectdataname="PoolNonpagedBytes", classid=z, Expression="PoolNonpagedBytes/1024"

    note1: y=max(collectdataid)
    note2: z= result of step3 above

repeat all the steps above in probe
connect to each probe and do the steps above


Step 2: Add a monitor

  • Open central URL and go to Admin-> Monitoring Templates-> Windows Base WMI Template->New Monitor-> Add Bulk
  • Provide the following info
    • name= PoolNonpagedBytes
    • oid=PoolNonpagedBytes
      *  - the OID should be the same as collectdataname in the insert query above
    • Tabular = no
  • Save the Template
  • Cancel the final step

Step 3: Update the monitor details

set the protocal to WMI
  1. update graphdetails set protocolid=(select protocolid from protocoldetails where protocolname="WMI") where graphname like "%PoolNonpagedBytes%"
insert into graphuserprops
  1. select graphid from graphdetails where graphname like "%PoolNonpagedBytes%"
  2. insert into graphuserprops set graphid=z,propname="GROUPNAME",propvalue="WMI"

z=result from above select graphid step


repeat steps in probe
connect to probe database and repeat the steps above

Step 4: Check if everything is OK

Fill the table below before you proceed to this add monitor to the device

Execute this query
ColumnName
Central
Probe
select * from wmiclass where classname like "%Win32_PerfFormattedData
_PerfOS_Memory
%"
classid
46
46

classname
Win32_PerfFormattedData
_PerfOS_Memory
Win32_PerfFormattedData
_PerfOS_Memory
select * from wmipolleddata where collectdataname like "%PoolNonpagedBytes%"
collectdataid
199
200000000200
(these numbers can be different... not a problem)

collectdataname
PoolNonpagedBytesPoolNonpagedBytes

classid
46
46

expression
PoolNonpagedBytes/1024PoolNonpagedBytes/1024

criteria
null
null

instance
null
null
select * from graphdetails where graphname like "%PoolNonpagedBytes%"
graphid
1441
1441

graphname
PoolNonpagedBytesPoolNonpagedBytes

protocolid
885
885

graphtypeid
890
890
select * from graphuserprops where graphid=1441
graphid
1441
1441

propname
GROUPNAME
GROUPNAME

propvalue
WMI
WMI
select * from polleddata where name like "%PoolNonpagedBytes%" and agent like "%device with this monitor%"
id
2000000209220000002092

oid
PoolNonpagedBytesPoolNonpagedBytes

ISMULTIPLEPOLLEDDATAfalsefalse

GROUPNAMEWMIWMI

SAVEABSOLUTESfalsefalse



Step5: Add the monitor to the device
  • Go to the device snapshot page and add the monitor.
  • Do a test monitor and see if it shows the data correctly






 RSS of this page

rtttrrb