TracNav menu
-
Home
-
Documentation...
-
Information...
-
Commands/Modules
-
CheckDisk...
-
CheckEventLog...
-
CheckSystem...
-
CheckHelpers...
-
CheckTaskSched...
-
FileLogger...
-
NRPEListener...
-
NSClientListener...
-
SysTray...
-
CheckWMI
- CheckWMI
- CheckWMIValue
-
RemoteConfiguration...
-
CheckExternalScripts...
-
LUAScript...
-
NSCAAgent...
-
Donate...
CheckWMIValue
CheckWMIValue is part of the wiki:CheckWMI module.
It is still alpha need to do more testing but I would like to get some initialö feedback on the syntax and such. Also feel free to try it out and report bugs to me (might wanna keep track of memory and such as I have not done so myself yet) To debug and help you setup your queries there is also a command line interface to run queries and see the result.
nsclient++ CheckWMI <query>
The syntax for this is Similar to other check commands so it should be pretty straight forward to set it up. The plugin will run a WMI query and check the returned columns against bounds provided by the checker (nagios) and report the result.
| Option | Values | Description |
| MaxWarn | Numeric value | The maximum allowed value for the column(s). |
| MaxCrit | Numeric value | The maximum allowed value for the column(s). |
| MinWarn | Numeric value | The minimum allowed value for the column(s). |
| MinCrit | Numeric value | The minimum allowed value for the column(s). |
| ShowAll | Empty, long | If present will display information even if an item is not reporting a state. If set to long will display more information. |
| Query | WMI Query | The WMI query to ask (not stackable, only one query at a time) |
| Check | A column name | A column name to check (if * all columns will be checked) (this is stackable, so you can compare any number of columns) |
| truncate | numeric value | The maximum length of the query-result. |
| AliasCol? | Column name | A column to be included (prefixed) in the alias for matching columns. |
Examples
Check to see if there is 2 CPUs present (or cores)
CheckWMI MaxCrit=3 MinWarn=1 "Query:load=Select * from win32_Processor"
Check the CPU load on all CPUs and warn if above 50 and critical if above 80
CheckWMIValue "Query=Select * from win32_Processor" MaxWarn=50 MaxCrit=80 Check:CPU=LoadPercentage ShowAll=long
To try a query use the following syntax:
nsclient++ CheckWMI Select * from win32_Processor
Check threads in processes and make sure a process does not have more then 50 threads (critical at 100)
CheckWMIValue "Query=select Caption, ThreadCount from Win32_Process" MaxWarn=50 MaxCrit=100 Check:threads=ThreadCount AliasCol=Caption Gives you: System threads: 98 > warning, svchost.exe threads: 87 > warning|'System Idle Process threads'=2;50;100; 'System threads'=98;50;100; 'smss.exe threads'=3;50;100; 'csrss.exe threads'=13;50;100; 'winlogon.exe threads'=21;50;100; 'services.exe threads'=18;50;100; 'lsass.exe threads'=21;50;100; 'svchost.exe threads'=19;50;100; 'svchost.exe threads'=11;50;100; 'svchost.exe threads'=87;50;100; 'svchost.exe threads'=6;50;100; 'svchost.exe threads'=18;50;100; 'aswUpdSv.exe threads'=3;50;100; 'ashServ.exe threads'=28;50;100; 'sdmcp.exe threads'=3;50;100; 'spoolsv.exe threads'=11;50;100; 'svchost.exe threads'=4;50;100; 'MSCamS32.exe threads'=5;50;100; 'nTuneService.exe threads'=4;50;100; 'nvsvc32.exe threads'=4;50;100; 'svchost.exe threads'=7;50;100; 'tlswrap.exe threads'=4;50;100; 'vmount2.exe threads'=4;50;100; 'vmnat.exe threads'=3;50;100; 'vmnetdhcp.exe threads'=2;50;100; 'vmware-authd.exe threads'=7;50;100; 'ashMaiSv.exe threads'=8;50;100; 'ashWebSv.exe threads'=22;50;100; 'alg.exe threads'=5;50;100; 'explorer.exe
(I know these are not very usefull, but hopefully they will give you an idea how to do things, there a *a lot* of things to check via the WMI so you ought to be able to do most things you want.)
--
Little example on W32_PingStatus, I use this to check my VPN tunnels.
define command{
command_name check_vpn
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -u -t 60 -p 5666 -c CheckWMIValue -a 'Query=SELECT StatusCode FROM Win32_PingStatus WHERE Address="$ARG1$"' MaxCrit=1 Check:Status:=StatusCode
}
Status-Code = 0 means good. Everything above 0 is BAD
For more information on Win32_PingStatus See: http://msdn.microsoft.com/en-us/library/aa394350(VS.85).aspx




