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

Login

Remember Me

Directory Tree

check_smartwmi SMART Monitoring for Windows by using builtin WMI

Rating
10 votes
Favoured:
3
Current Version
1.6
Last Release Date
2014-03-16
Compatible With
  • Nagios 3.x
Owner
License
GPL
Hits
47735
Files:
FileDescription
check_smartwmi.vbscheck_smartwmi.vbs
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
Summary:

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.
Description:

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:
[/settings/NRPE/server]
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:
http://www.microsoft.com/en-us/download/details.aspx?id=8572
Reviews (2)
byraudner_peter, September 8, 2019
hello,
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 10.100.32.117 -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.