Environmental

check_ohm_temperatures

Description:

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.

Current Version

1.1

Last Release Date

2016-03-24

Compatible With

  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios 4.x
  • Nagios XI

Owner

License

Apache


Project Files
Project Notes
This is 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. 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. EXAMPLE: .check_ohm_temperatures.ps1 -warning 80 -critical 90
Reviews (2) Add a Review
Just what I needed
by johnjore, August 31, 2017

Made some tweaks to make it more flexible without using additional files. I've published my version here: https://github.com/johnjore/Nagios-Plugins/blob/master/check_ohm_temperatures.ps1 JJ



Excellent!
by wymangr, June 30, 2017

Worked great! I just modified the script a little to separate the temperatures for my CPU and Hard Drives so they report to Nagios and graph separately. All I did was create two instances of the script and change the following for each file. Changed "-Query "SELECT + FROM Sensor WHERE Sensortype='Temperature'" to "-Query "SELECT + FROM Sensor WHERE Name='core #1 - #8'" -- To display CPU temp and "-Query "SELECT + FROM Sensor WHERE Name='Temperature'" -- To display the temps of the Hard Drives The "Name" might be different depending on your hardware, but if you run : Get-WmiObject -Namespace "RootOpenHardwareMonitor" Class: sensor From Powershell while OpenHardwareMonitor is running it will give you a list of all the sensors and their names that are being monitored. I'm running : NagiosĀ® Core Version 4.3.2 OpenHardwareMonitor 0.8.0 Beta



Add a Review

You must be logged in to submit a review.

Thank you for your review!

Your review has been submitted and is pending approval.

Recommend

To:


From:


Thank you for your recommendation!

Your recommendation has been sent.

Project Stats
Rating
5 (3)
Favorites
0
Views
11,068