check_wmi

Check status and metrics by running WMI queries.

In order to use this plugin, you need to enable 'CheckWMI' in the '[/modules]' section of the snclient_local.ini.

Implementation

WindowsLinuxFreeBSDMacOSX
✅

Argument Defaults

ArgumentDefault Value
empty-state3 (UNKNOWN)
empty-syntaxquery did not return any result row.
top-syntax${list}
ok-syntax
detail-syntax%(line)

Check Specific Arguments

ArgumentDescription
namespaceThe WMI namespace to query (default: root\cimv2)
passwordUnused and not supported for now
queryThe WMI query to execute
targetUnused and not supported for now
userUnused and not supported for now

Examples

Default Check

check_wmi "query=select DeviceID, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = 'C:'"
C:, 27955118080

Same query, but use output template for custom plugin output:

check_wmi "query=select DeviceID, FreeSpace FROM Win32_LogicalDisk WHERE DeviceID = 'C:'" "detail-syntax= %(DeviceID) %(FreeSpace:h)"
C: 27.94 G

Performance data will be extracted if the query contains at least 2 attributes. The first one must be a name, the others must be numeric.

check_wmi query="select DeviceID, FreeSpace, Size FROM Win32_LogicalDisk"
C:, 27199328256 |'C: FreeSpace'=27199328256

Use perf-config to format the performance data and apply thresholds:

check_wmi query="select DeviceID, FreeSpace FROM Win32_LogicalDisk" perf-config="*(unit:B)" warn="FreeSpace > 1000000"
C:, 27199328256 |'C: FreeSpace'=27199328256B;1000000

Example using check_snclient and Naemon

Naemon Config

define command{
    command_name         check_snclient
    command_line         $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}

define service {
    host_name            testhost
    service_description  check_wmi
    use                  generic-service
    check_command        check_snclient!check_wmi!
}