Skip to content

Instantly share code, notes, and snippets.

@rothwerx
Last active December 19, 2015 13:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rothwerx/5960677 to your computer and use it in GitHub Desktop.
Python: Use hpilo to query iLO ambient temperature sensor, i.e. use HP sensors for ghetto datacenter temperature monitoring
import hpilo
tempkey = {
2 : 'Temp 1',
3 : 'Temp 1',
4 : '01-Inlet Ambient'
}
def get_ambient_temp(host, username, password, ilo_version):
try:
# Specifying the protocol saves a query to the iLO
if ilo_version <= 2:
proto = hpilo.ILO_RAW
else:
proto = hpilo.ILO_HTTP
ilo = hpilo.Ilo(host, username, password, protocol=proto)
health = ilo.get_embedded_health()
celsius = health['temperature'][tempkey[ilo_version]]['currentreading'][0]
return celsius
except hpilo.IloError:
return None
def CtoF(cel):
"Convert Celsius to Fahrenheit"
return '%.2f' % (cel * 1.8 +32)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment