The congress.datasources.ceilometer_driver Module

class congress.datasources.ceilometer_driver.CeilometerDriver(name='', args=None)

Bases: congress.datasources.datasource_driver.PollingDataSourceDriver, congress.datasources.datasource_driver.ExecutionDriver

ALARMS = 'alarms'
ALARM_THRESHOLD_RULE = 'alarms.threshold_rule'
EVENTS = 'events'
EVENT_TRAITS = 'events.traits'
METERS = 'meters'
STATISTICS = 'statistics'
TRANSLATORS = [{'selector-type': 'DICT_SELECTOR', 'table-name': 'meters', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'meter_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'unit', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'source', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'resource_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'user_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'project_id', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DICT_SELECTOR', 'table-name': 'alarms', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'alarm_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'enabled', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'threshold_rule', 'translator': {'val-col': 'value', 'table-name': 'alarms.threshold_rule', 'translator': {'translation-type': 'VALUE'}, 'id-col': 'threshold_rule_id', 'translation-type': 'VDICT', 'key-col': 'key'}, 'col': 'threshold_rule_id'}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'description', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'time_constraints', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'user_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'project_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'alarm_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ok_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'insufficient_data_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'repeat_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'timestamp', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state_timestamp', 'translator': {'translation-type': 'VALUE'}})}, {'selector-type': 'DICT_SELECTOR', 'table-name': 'events', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'message_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'event_type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'generated', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'traits', 'translator': {'selector-type': 'DICT_SELECTOR', 'table-name': 'events.traits', 'parent-key': 'message_id', 'parent-col-name': 'event_message_id', 'in-list': True, 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'value', 'translator': {'translation-type': 'VALUE'}})}})}, {'selector-type': 'DICT_SELECTOR', 'table-name': 'statistics', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'meter_name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'groupby', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb999ee140>}, 'col': 'resource_id'}, {'fieldname': 'avg', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'count', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration_start', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration_end', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'max', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'min', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period_end', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period_start', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'sum', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'unit', 'translator': {'translation-type': 'VALUE'}})}]
alarms_translator = {'selector-type': 'DICT_SELECTOR', 'table-name': 'alarms', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'alarm_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'enabled', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'threshold_rule', 'translator': {'val-col': 'value', 'table-name': 'alarms.threshold_rule', 'translator': {'translation-type': 'VALUE'}, 'id-col': 'threshold_rule_id', 'translation-type': 'VDICT', 'key-col': 'key'}, 'col': 'threshold_rule_id'}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'description', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'time_constraints', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'user_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'project_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'alarm_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'ok_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'insufficient_data_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'repeat_actions', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'timestamp', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'state_timestamp', 'translator': {'translation-type': 'VALUE'}})}
events_translator = {'selector-type': 'DICT_SELECTOR', 'table-name': 'events', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'message_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'event_type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'generated', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'traits', 'translator': {'selector-type': 'DICT_SELECTOR', 'table-name': 'events.traits', 'parent-key': 'message_id', 'parent-col-name': 'event_message_id', 'in-list': True, 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'value', 'translator': {'translation-type': 'VALUE'}})}})}
execute(action, action_args)

Overwrite ExecutionDriver.execute().

static get_datasource_info()
initialize_update_method()
meters_translator = {'selector-type': 'DICT_SELECTOR', 'table-name': 'meters', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'meter_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'type', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'unit', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'source', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'resource_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'user_id', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'project_id', 'translator': {'translation-type': 'VALUE'}})}
safe_id(x)
statistics_translator = {'selector-type': 'DICT_SELECTOR', 'table-name': 'statistics', 'translation-type': 'HDICT', 'field-translators': ({'fieldname': 'meter_name', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'groupby', 'translator': {'translation-type': 'VALUE', 'extract-fn': <function safe_id at 0x7fdb999ee140>}, 'col': 'resource_id'}, {'fieldname': 'avg', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'count', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration_start', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'duration_end', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'max', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'min', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period_end', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'period_start', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'sum', 'translator': {'translation-type': 'VALUE'}}, {'fieldname': 'unit', 'translator': {'translation-type': 'VALUE'}})}
value_trans = {'translation-type': 'VALUE'}