Home Directory Plugins Operating Systems Windows NRPE check_smartwmi SMART Monitoring for Windows by using builtin WMI

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree

check_smartwmi SMART Monitoring for Windows by using builtin WMI

10 votes
Current Version
Last Release Date
Compatible With
  • Nagios 3.x
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download

vbs script that uses built-in WMI to gather SMART status.
Checks for SMART FailurePredictStatus and SMART attributes, temperature and calculates health status on all hard disks.
Works without Nagios too. May not work with hardware RAID.

I couldnt find any reliable script to get appropriate reports of disk health, so i just wrote a new one. Its not enough to rely on Smart predicted health status because bad sectors will not immediately trigger an change to this state. The vendor defaults are triggered very late on a HDD, so for an early warning system its better to monitor each important SMART attributes.
The SMART actual and worst normalized values e.g. 100 100 are more usefull for SSD.

The script will:
- monitor all disks where wmi can poll data
- monitor important Smart Attributes by normalized and raw value and set alarm if out of bounds (although its hard to use raw values on some specific disks, as there are no standards defined)
- print out all raw Smart Attributes with correct decimal values (if nagios parameter is disabled)
- calculate health in % for HDD out of Smart Attributes ID 1,5,10,196-199 similar to Disk Sentinel
- show remaining reserve blocks on SSD in % and generate alarm if too low
- display writes in GB on SSD
- gather Smart FailurePredictStatus (again, often not accurate but i just included it)
- monitor for warning/critical temperature
- generate warning for old disks (default 30k hours)

This script will not:
- Readout Smart Thresholds, because i didnt found any WMI class
- Get data from disks in standby

Tested under Nagios 3.x with good and defective HDD.

For installation copy the vbs script to your Nsclient++ scripts folder and add:

[/settings/external scripts/scripts]
check_smartwmi = cscript.exe //nologo //T:60 scriptsDOUBLEBACKSLASHcheck_smartwmi.vbs /warn:$ARG1$ /crit:$ARG2$

Attention: I wrote DOUBLEBACKSLASH because it gets converted by nagios.org to a single backslash! Please check your Nagios config before giving bad votes!

Be sure to allow also arguments if you dont use alias in nsclient.ini:
allow arguments=true

[/settings/external scripts/server]
allow arguments=true

[/settings/external scripts]
allow arguments = true

On Nagios server just add to windows.cfg a new service and:
check_command check_nrpe!check_smartwmi!40!50

Please note: If you specify command in nsclient.ini with /warn:$ARG1$ and /crit:$ARG2$ then the command in nagios has to be also started with arguments, otherwise you will get an "CInt" error. The vbs can not be run with invalid arguments.

Test it on Nagios server console with:
/usr/lib/nagios/plugins/check_nrpe -H yourwinhost -c check_smartwmi -a 40 50

Important note:
The script may not work when Hardware RAID is used. It relies on getting the information from WMI:
Namespace: rootWMI
Class: MSStorageDriver_ATAPISmartData
find out also with this tool:
Reviews (2)
byraudner_peter, September 8, 2019
i got the following error message:
C:\Program Files\NSClient++\scripts\itn\check_smartwmi.vbs(131, 1) Laufzeitfehler in Microsoft VBScript: Typenkonflikt: 'CInt'
can you help me please?
best regards
byottow, March 26, 2014
0 of 2 people found this review helpful
Testing this commad on Windows 2012 produces the following error:
/usr/local/nagios/libexec/check_nrpe -H -c check_smartwmi -a 5 10
No output available from command (cscript.exe //nologo //T:60 scripts/check_smartwmi.vbs /warn:$ARG1$ /crit:$ARG2$)
Owner's reply

Your Nagios configuration is incorrect, this is not a valid command:
cscript.exe //nologo //T:60 scripts/check_smartwmi.vbs /warn:$ARG1$ /crit:$ARG2$
The path to vbs is wrong and the 2 arguments are probably also not passed.