The ceilometer.alarm.storage.impl_sqlalchemy ModuleΒΆ

SQLAlchemy storage backend.

class ceilometer.alarm.storage.impl_sqlalchemy.Connection(url)[source]

Bases: ceilometer.alarm.storage.base.Connection

Put the data into a SQLAlchemy database.

Tables:

- meter
  - meter definition
  - { id: meter def id
      name: meter name
      type: meter type
      unit: meter unit
      }
- sample
  - the raw incoming data
  - { id: sample id
      meter_id: meter id            (->meter.id)
      user_id: user uuid
      project_id: project uuid
      resource_id: resource uuid
      source_id: source id
      resource_metadata: metadata dictionaries
      volume: sample volume
      timestamp: datetime
      message_signature: message signature
      message_id: message uuid
      }
clear()[source]
create_alarm(alarm)[source]

Create an alarm.

Parameters:alarm – The alarm to create.
delete_alarm(alarm_id)[source]

Delete an alarm

Parameters:alarm_id – ID of the alarm to delete
get_alarm_changes(alarm_id, on_behalf_of, user=None, project=None, alarm_type=None, severity=None, start_timestamp=None, start_timestamp_op=None, end_timestamp=None, end_timestamp_op=None)[source]

Yields list of AlarmChanges describing alarm history

Changes are always sorted in reverse order of occurrence, given the importance of currency.

Segregation for non-administrative users is done on the basis of the on_behalf_of parameter. This allows such users to have visibility on both the changes initiated by themselves directly (generally creation, rule changes, or deletion) and also on those changes initiated on their behalf by the alarming service (state transitions after alarm thresholds are crossed).

Parameters:
  • alarm_id – ID of alarm to return changes for
  • on_behalf_of – ID of tenant to scope changes query (None for administrative user, indicating all projects)
  • user – Optional ID of user to return changes for
  • project – Optional ID of project to return changes for
  • alarm_type – Optional change type
  • severity – Optional alarm severity
  • start_timestamp – Optional modified timestamp start range
  • start_timestamp_op – Optional timestamp start range operation
  • end_timestamp – Optional modified timestamp end range
  • end_timestamp_op – Optional timestamp end range operation
get_alarms(name=None, user=None, state=None, meter=None, project=None, enabled=None, alarm_id=None, pagination=None, alarm_type=None, severity=None)[source]

Yields a lists of alarms that match filters.

Parameters:
  • name – Optional name for alarm.
  • user – Optional ID for user that owns the resource.
  • state – Optional string for alarm state.
  • meter – Optional string for alarms associated with meter.
  • project – Optional ID for project that owns the resource.
  • enabled – Optional boolean to list disable alarm.
  • alarm_id – Optional alarm_id to return one alarm.
  • pagination – Optional pagination query.
  • alarm_type – Optional alarm type.
  • severity – Optional alarm severity
query_alarm_history(filter_expr=None, orderby=None, limit=None)[source]

Return an iterable of model.AlarmChange objects.

query_alarms(filter_expr=None, orderby=None, limit=None)[source]

Yields a lists of alarms that match filter.

record_alarm_change(alarm_change)[source]

Record alarm change event.

update_alarm(alarm)[source]

Update an alarm.

Parameters:alarm – the new Alarm to update
upgrade()[source]