This is a PowerShell script used by NSClient++ to check the temperatures on a host running Microsoft Windows. NSClient++ can then be called by Nagios (Op5 Monitor, Icinga or similar) to run this script.
[Open Hardware Monitor] (http://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.
There is no standardized way to retrieve the temperatures in Windows even if the hardware has a temperature sensor. Open Hardware monitor supports many sensors and is open source.
All the found temperatures will be output as performance data so that they can be graphed.
Tested with Windows 7 and Windows 2003.
Define the command in NSClient++:
cmd /c echo scripts\custom\check_temperatures.ps1 -warning $ARG1$ -critical $ARG2$; exit($lastexitcode) | powershell.exe -command -
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
- 1.1 2016-03-24 Minor cleanup of variables and documentation.
- 1.0 2016-03-11 Initial release.
Licensed under the Apache License Version 2.0
Written by email@example.com