A PowerShell script used by NSClient++ to check the temperatures on a host running Windows. NSClient++ can then be called by Nagios to run this script.
The script uses OpenHardwareMonitor.org to read the temperatures.
Open Hardware Monitor (openhardwaremonitor.org) is used as a driver for the temperature sensors. Open Hardware monitor creates WMI objects of all the found sensors. This script retrieves the temperatures from those WMI objects. This means that you have to download and run OpenHardwareMonitor.exe before running this check.
All the found temperatures will be output as performance data so that they can be graphed.
Tested with different versions of Windows 7.
The script should work with all versions of Windows that can run PowerShell and on hardware where OpenHardwaremonitor can detect at least one temperature sensor.
Define the command in nsclient++: cmd /c echo scriptscustomcheck_temperatures.ps1 -warning $ARG1$ -critical $ARG2$; exit($lastexitcode) | powershell.exe -command – or you can omit or hard code the warning and critical arguments in case you do not permit sending arguments to nsclient.
.check_ohm_temperatures.ps1 -warning 80 -critical 90