Nagios plugin for WMI

1 min read

check-wmic is a Nagios plugin to monitor Windows systems via WMI (Windows
Management Instrumentation) from Windows. It uses command line tool WMIC,
available as standard from Windows XP/2003 on. It previously existed as check_wmic.

Examples:

check_wmic --host 10.0.0.100 --user abra --password kadabra --alias cpu --property LoadPercentage --every 4 --repeat 4 --format "CPU load %.2f%.|'CPU Load'=%.2f%" --warning 75 --critical 90
Connects to the host by the supplied credentials, collects CPU load percentage three times (the first one of four is dropped) with 4-secs intervals, calculates an average value, and produces an output according to the format specified. Returns CRITICAL if the load is more than 90%, WARNING if it is more than 75%.
check_wmic --host 10.0.0.100 --alias "LogicalDisk where DeviceID='C:'" --property FreeSpace --factor 0.0000009536743 --format "Free disk space on C: %.2f MB|'Free C:'=%.2fMB" --warn 500 --crit 50
Connects to the host by the current user's credentials, collects free space available on C-disk in bytes, converts it to MB by using the factor specified, and produces an output according to the format specified. Returns CRITICAL if free space is under 50 MB, WARNING if it is under 500 MB.
check_wmic --host 10.0.0.100 --alias "LogicalDisk where DeviceID='C:'" --property FreeSpace --Ratio Size --format "Free disk space on C: %.2f% |'Free C:'=%.2f%" --warn 2 --critical 0.5 --compare lt
Connects to the host by the current user's credentials, collects free space and size on C-disk in bytes, calculates free space ratio (freespace/size), and produces an output according to the format specified. Returns WARNING if free space is less than 2%, CRITICAL if it is less than 0.5%.
check_wmic --host 10.0.0.100 --user 'abra@nuke.local' --password '!!"#%&' --alias "Service where (StartMode='Auto' And State!='Running')" --property Name --count --format "%d non-running automatic services." --crit 5
Connects to the host by the supplied domain account credentials, collects the instances of automatic Windows services which are not running, counts them, and produces an output according to the format specified. Returns CRITICAL if there are at least 5 such services.

Github Repo