Merge "Add maximum fan rpm to hardware.ipmi.fan metrics"
This commit is contained in:
commit
ef25114840
@ -107,6 +107,10 @@ class SensorPollster(plugin_base.PollsterBase):
|
|||||||
'node': self.conf.host
|
'node': self.conf.host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extra_metadata = self.get_extra_sensor_metadata(sensor_data)
|
||||||
|
if extra_metadata:
|
||||||
|
metadata.update(extra_metadata)
|
||||||
|
|
||||||
yield sample.Sample(
|
yield sample.Sample(
|
||||||
name='hardware.ipmi.%s' % self.METRIC.lower(),
|
name='hardware.ipmi.%s' % self.METRIC.lower(),
|
||||||
type=sample.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
@ -117,6 +121,11 @@ class SensorPollster(plugin_base.PollsterBase):
|
|||||||
resource_id=resource_id,
|
resource_id=resource_id,
|
||||||
resource_metadata=metadata)
|
resource_metadata=metadata)
|
||||||
|
|
||||||
|
def get_extra_sensor_metadata(self, sensor_data):
|
||||||
|
# override get_extra_sensor_metadata to add specific metrics for
|
||||||
|
# each sensor
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class TemperatureSensorPollster(SensorPollster):
|
class TemperatureSensorPollster(SensorPollster):
|
||||||
METRIC = 'Temperature'
|
METRIC = 'Temperature'
|
||||||
@ -129,6 +138,16 @@ class CurrentSensorPollster(SensorPollster):
|
|||||||
class FanSensorPollster(SensorPollster):
|
class FanSensorPollster(SensorPollster):
|
||||||
METRIC = 'Fan'
|
METRIC = 'Fan'
|
||||||
|
|
||||||
|
def get_extra_sensor_metadata(self, sensor_data):
|
||||||
|
try:
|
||||||
|
return {
|
||||||
|
"maximum_rpm": sensor_data['Normal Maximum'],
|
||||||
|
}
|
||||||
|
except KeyError:
|
||||||
|
# Maximum rpm might not be reported when usage
|
||||||
|
# is reported as percent
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
class VoltageSensorPollster(SensorPollster):
|
class VoltageSensorPollster(SensorPollster):
|
||||||
METRIC = 'Voltage'
|
METRIC = 'Voltage'
|
||||||
|
@ -606,6 +606,25 @@ FAN_DATA = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FAN_DATA_PERCENT = {
|
||||||
|
'Fan 1 (0x23)': {
|
||||||
|
'Sensor ID': 'Fan 1 (0x23)',
|
||||||
|
'Entity ID': '7.1 (System Board)',
|
||||||
|
'Sensor Type (Threshold)': 'Fan (0x04)',
|
||||||
|
'Sensor Reading': '47.040 (+/- 0) percent',
|
||||||
|
'Status': 'ok',
|
||||||
|
'Positive Hysteresis': 'Unspecified',
|
||||||
|
'Negative Hysteresis': 'Unspecified',
|
||||||
|
'Minimum sensor range': 'Unspecified',
|
||||||
|
'Maximum sensor range': 'Unspecified',
|
||||||
|
'Event Message Control': 'Global Disable Only',
|
||||||
|
'Readable Thresholds': '',
|
||||||
|
'Settable Thresholds': '',
|
||||||
|
'Assertions Enabled': ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOLTAGE_DATA = {
|
VOLTAGE_DATA = {
|
||||||
'Planar 12V (0x18)': {
|
'Planar 12V (0x18)': {
|
||||||
'Status': 'ok',
|
'Status': 'ok',
|
||||||
|
@ -28,6 +28,10 @@ FAN_SENSOR_DATA = {
|
|||||||
'Fan': ipmi_test_data.FAN_DATA
|
'Fan': ipmi_test_data.FAN_DATA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FAN_SENSOR_DATA_PERCENT = {
|
||||||
|
'Fan': ipmi_test_data.FAN_DATA_PERCENT
|
||||||
|
}
|
||||||
|
|
||||||
VOLTAGE_SENSOR_DATA = {
|
VOLTAGE_SENSOR_DATA = {
|
||||||
'Voltage': ipmi_test_data.VOLTAGE_DATA
|
'Voltage': ipmi_test_data.VOLTAGE_DATA
|
||||||
}
|
}
|
||||||
@ -108,6 +112,20 @@ class TestFanSensorPollster(base.TestPollsterBase):
|
|||||||
self._verify_metering(12, float(7140), self.CONF.host)
|
self._verify_metering(12, float(7140), self.CONF.host)
|
||||||
|
|
||||||
|
|
||||||
|
class TestFanPercentSensorPollster(base.TestPollsterBase):
|
||||||
|
|
||||||
|
def fake_sensor_data(self, sensor_type):
|
||||||
|
return FAN_SENSOR_DATA_PERCENT
|
||||||
|
|
||||||
|
def make_pollster(self):
|
||||||
|
return sensor.FanSensorPollster(self.CONF)
|
||||||
|
|
||||||
|
def test_get_samples(self):
|
||||||
|
self._test_get_samples()
|
||||||
|
|
||||||
|
self._verify_metering(1, float(47.04), self.CONF.host)
|
||||||
|
|
||||||
|
|
||||||
class TestCurrentSensorPollster(base.TestPollsterBase):
|
class TestCurrentSensorPollster(base.TestPollsterBase):
|
||||||
|
|
||||||
def fake_sensor_data(self, sensor_type):
|
def fake_sensor_data(self, sensor_type):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user