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 = [{'table-name': 'meters', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'alarms', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'alarm_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'enabled'}, {'translator': {'id-col': 'threshold_rule_id', 'val-col': 'value', 'translation-type': 'VDICT', 'translator': {'translation-type': 'VALUE'}, 'table-name': 'alarms.threshold_rule', 'key-col': 'key'}, 'fieldname': 'threshold_rule', 'col': 'threshold_rule_id'}, {'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'events', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'message_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'event_type'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'generated'}, {'translator': {'in-list': True, 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT', 'parent-key': 'message_id', 'parent-col-name': 'event_message_id', 'table-name': 'events.traits', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'type'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'value'})}, 'fieldname': 'traits'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}, {'table-name': 'statistics', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'meter_name'}, {'translator': {'extract-fn': <function safe_id at 0x7f25786951b8>, 'translation-type': 'VALUE'}, 'fieldname': 'groupby', 'col': 'resource_id'}, {'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}]
alarms_translator = {'table-name': 'alarms', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'alarm_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'state'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'enabled'}, {'translator': {'id-col': 'threshold_rule_id', 'val-col': 'value', 'translation-type': 'VDICT', 'translator': {'translation-type': 'VALUE'}, 'table-name': 'alarms.threshold_rule', 'key-col': 'key'}, 'fieldname': 'threshold_rule', 'col': 'threshold_rule_id'}, {'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}
events_translator = {'table-name': 'events', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'message_id'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'event_type'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'generated'}, {'translator': {'in-list': True, 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT', 'parent-key': 'message_id', 'parent-col-name': 'event_message_id', 'table-name': 'events.traits', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'name'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'type'}, {'translator': {'translation-type': 'VALUE'}, 'fieldname': 'value'})}, 'fieldname': 'traits'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}
execute(action, action_args)

Overwrite ExecutionDriver.execute().

static get_datasource_info()
initialize_update_method()
meters_translator = {'table-name': 'meters', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}
safe_id(x)
statistics_translator = {'table-name': 'statistics', 'field-translators': ({'translator': {'translation-type': 'VALUE'}, 'fieldname': 'meter_name'}, {'translator': {'extract-fn': <function safe_id at 0x7f25786951b8>, 'translation-type': 'VALUE'}, 'fieldname': 'groupby', 'col': 'resource_id'}, {'translator': {'translation-type': 'VALUE'}, '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'}), 'selector-type': 'DICT_SELECTOR', 'translation-type': 'HDICT'}
value_trans = {'translation-type': 'VALUE'}