cocluto/Ipmi/ClusterNodeSensorsReadings.py

43 lines
1.2 KiB
Python
Raw Normal View History

import Sensor
class ClusterNodeSensorsReadings:
"""
"""
"""
POWERSTATE_UNKNOWN=0
POWERSTATE_OFF=1
POWERSTATE_ON=2
POWERSTATE_SLEEP=3
"""
def __init__(self, clusterNodeName):
self.m_clusterNodeName = clusterNodeName
self.m_sensors = {}
#self.m_powerState = ClusterNodeStatus.POWERSTATE_UNKNOWN
return
def addSensor(self, sensor):
self.m_sensors[sensor.m_name] = sensor
def dump(self):
for key,sensor in self.m_sensors.iteritems():
sensor.dump()
return
#def getPowerState(self):
# return self.m_powerState
def getLowestTemperature( self ):
#log('ClusterNodeSensorsReadings::getLowestTemperature : start')
lowestTemperature = 0.0
lowestTemperatureIsDefined = False
for key,sensor in self.m_sensors.iteritems():
#log('ClusterNodeSensorsReadings::getLowestTemperature : start')
if sensor.typeName() == 'Temperature':
sensor.m_temperature
if lowestTemperatureIsDefined:
if sensor.m_temperature < lowestTemperature:
lowestTemperature = sensor.m_temperature
else:
lowestTemperature = sensor.m_temperature
lowestTemperatureIsDefined = True
assert( lowestTemperatureIsDefined )
#log('ClusterNodeSensorsReadings::getLowestTemperature : end')
return lowestTemperature