From 905c41b021d8a56b6dd3a8a0e41f6466adbf2292 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 20 Jul 2015 15:03:18 -0400 Subject: [PATCH] Add numeric state_ids to sensor readings A plugin may provide a numeric enumeration for state ids. Provide that for programmatic recognition of events in addition to being able to combine the available text. --- confluent_server/confluent/messages.py | 2 ++ confluent_server/confluent/plugins/hardwaremanagement/ipmi.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index b12a0e31..cdb221dd 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -746,6 +746,8 @@ class SensorReadings(ConfluentMessage): sensordict['units'] = sensor['units'] if 'states' in sensor: sensordict['states'] = sensor['states'] + if 'state_ids' in sensor: + sensordict['state_ids'] = sensor['state_ids'] if 'health' in sensor: sensordict['health'] = sensor['health'] if 'type' in sensor: diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index c82753c3..4a8f902b 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -279,7 +279,8 @@ persistent_ipmicmds = {} def _dict_sensor(pygreading): retdict = {'name': pygreading.name, 'value': pygreading.value, - 'states': pygreading.states, 'units': pygreading.units, + 'states': pygreading.states, 'state_ids': pygreading.state_ids, + 'units': pygreading.units, 'health': _str_health(pygreading.health), 'type': pygreading.type, }