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:

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.

Monitoring HP ProLiant via PowerShell & WMI: Drive Health

This is the first in a series of posts about monitoring HP ProLiant system health via PowerShell and WMI.

I chose to implement this as an alternative to SNMP since SNMP support in Windows Server is being EOL’ed.

These scripts were written to be used in conjunction with PRTG Network Monitor, but they can just as easily be adapted to display the information in a table by un-commenting a single line.

This functionality depends on the HP Insight Management WBEM providers being installed on the monitored server. The account you’re running the script as will also need permission to do remote WMI queries against the server in question.

Running the script in standalone mode will result in the following output:
2014-04-09 11_07_24-Windows PowerShell ISE

Out of the box, the script will output the data in XML as needed by PRTG:

        <channel>Port:1I Box:1 Bay:1 - SAS Disk P4W89D4A</channel>
        <channel>Port:1I Box:1 Bay:2 - SAS Disk P4WA9UUA</channel>
        <channel>Port:1I Box:1 Bay:3 - SAS Disk P4XWYJSA</channel>
        <channel>Port:1I Box:1 Bay:4 - SAS Disk P4XX08ZA</channel>
        <channel>Port:2I Box:1 Bay:5 - SAS Disk P4VX5AVA</channel>
        <channel>Port:2I Box:1 Bay:6 - SAS Disk P4W9Y78A</channel>

Setting up the script for PRTG

  1. Copy the script to Custom SensorsEXEXML in your PRTG installation folder. Remember to do this on all probes if you have multiple.
  2. Add a new sensor of type EXE/Script Advanced Sensor to the device that represents the ProLiant server you wish to monitor.
  3. Make sure the following sensor settings are configured as per below:
    1. Parameters: %host
    2. Security Context: ‘Use Windows credentials of parent device’

The script is configured to put the entire sensor into an error state if there’s a problem with one of the channels. It will also set the sensor message to indicate which disk is experiencing the problem.

Here’s the script: