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_ohm_temperatures

Rating
3 votes
Favoured:
0
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
Hits
11153
Files:
FileDescription
check_ohm_temperatures.ps1check_ohm_temperatures.ps1
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!
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.
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)
byjohnjore, August 12, 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
bywymangr, June 9, 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 "Root\OpenHardwareMonitor"
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