Monitoring HP ProLiant via PowerShell & WMI: Temperature Sensors

This second post in my series about monitoring HP ProLiant system health via PowerShell and WMI covers retrieving temperature sensor values and status.

As per the last post, this script is designed to work with PRTG but will work just as well in a standalone-manner if you comment out a line around #133:

# If you don't use PRTG, you could just un-comment the below line
#$customSensors | ft -AutoSize; exit;

Running in standalone mode will display the following:
image

The out-of-the-box output for PRTG will return XML.

The sensor’s warning threshold is determined by this line at the top of the script:

# I'm setting an arbitrary warning threshold at 75%
$warningThreshold = 0.75

I had to a bit of Select-String trickery to get a useful sensor name. This method won’t translate to other translations of the WBEM install (if HP even provide them), and will need to be tweaked:

Select-String -InputObject $sensor.description -Pattern '(?<=detects for )(.*)(?=. Temp)' -AllMatches).Matches[0].Value

# Turns this: 
"Temperature Sensor 7 detects for CPU board. Temperature reported by the sensor is within normal operating range."

# Into this:
"Temperature Sensor 7: CPU board"

See this section of the previous post about how to set up the sensor in PRTG.

https://gist.github.com/dstreefkerk/10226460.js

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s