mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 02:52:07 +00:00
Add support for normalized sensors
This opens the door for normalized common sensors for clients that care about the semantics but cannot keep track of inconsistent sensor names from implementation to implementation.
This commit is contained in:
parent
49a504972f
commit
0857716f64
@ -481,6 +481,20 @@ def _init_core():
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'normalized': {
|
||||
'inlet_temp': PluginRoute({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'average_cpu_temp': PluginRoute({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
'total_power': PluginRoute({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
}),
|
||||
},
|
||||
'energy': PluginCollection({
|
||||
'pluginattrs': ['hardwaremanagement.method'],
|
||||
'default': 'ipmi',
|
||||
|
@ -861,6 +861,23 @@ class IpmiHandler(object):
|
||||
resourcename = sensor['name']
|
||||
self.ipmicmd.sensormap[simplify_name(resourcename)] = resourcename
|
||||
|
||||
def read_normalized(self, sensorname):
|
||||
readings = None
|
||||
if sensorname == 'average_cpu_temp':
|
||||
cputemp = self.ipmicmd.get_average_processor_temperature()
|
||||
readings = [cputemp]
|
||||
elif sensorname == 'inlet_temp':
|
||||
inltemp = self.ipmicmd.get_inlet_temperature()
|
||||
readings = [inltemp]
|
||||
elif sensorname == 'total_power':
|
||||
sensor = EmptySensor('Total Power')
|
||||
sensor.states = []
|
||||
sensor.units = 'W'
|
||||
sensor.value = self.ipmicmd.get_system_power_watts()
|
||||
readings = [sensor]
|
||||
if readings:
|
||||
self.output.put(msg.SensorReadings(readings, name=self.node))
|
||||
|
||||
def read_sensors(self, sensorname):
|
||||
if sensorname == 'all':
|
||||
sensors = self.ipmicmd.get_sensor_descriptions()
|
||||
@ -1157,6 +1174,8 @@ class IpmiHandler(object):
|
||||
if len(self.element) < 3:
|
||||
return
|
||||
self.sensorcategory = self.element[2]
|
||||
if self.sensorcategory == 'normalized':
|
||||
return self.read_normalized(self.element[-1])
|
||||
# list sensors per category
|
||||
if len(self.element) == 3 and self.element[-2] == 'hardware':
|
||||
if self.sensorcategory == 'leds':
|
||||
|
@ -712,6 +712,23 @@ class IpmiHandler(object):
|
||||
resourcename = sensor['name']
|
||||
self.sensormap[simplify_name(resourcename)] = resourcename
|
||||
|
||||
def read_normalized(self, sensorname):
|
||||
readings = None
|
||||
if sensorname == 'average_cpu_temp':
|
||||
cputemp = self.ipmicmd.get_average_processor_temperature()
|
||||
readings = [cputemp]
|
||||
elif sensorname == 'inlet_temp':
|
||||
inltemp = self.ipmicmd.get_inlet_temperature()
|
||||
readings = [inltemp]
|
||||
elif sensorname == 'total_power':
|
||||
sensor = EmptySensor('Total Power')
|
||||
sensor.states = []
|
||||
sensor.units = 'W'
|
||||
sensor.value = self.ipmicmd.get_system_power_watts()
|
||||
readings = [sensor]
|
||||
if readings:
|
||||
self.output.put(msg.SensorReadings(readings, name=self.node))
|
||||
|
||||
def read_sensors(self, sensorname):
|
||||
if sensorname == 'all':
|
||||
sensors = self.ipmicmd.get_sensor_descriptions()
|
||||
@ -1012,6 +1029,8 @@ class IpmiHandler(object):
|
||||
if len(self.element) < 3:
|
||||
return
|
||||
self.sensorcategory = self.element[2]
|
||||
if self.sensorcategory == 'normalized':
|
||||
return self.read_normalized(self.element[-1])
|
||||
# list sensors per category
|
||||
if len(self.element) == 3 and self.element[-2] == 'hardware':
|
||||
if self.sensorcategory == 'leds':
|
||||
|
Loading…
Reference in New Issue
Block a user