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.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.