aodh/storage/models.py (parameters above maps to class Alarm)
-------------------------------------------------------------
import datetime
from aodh.i18n import _
from aodh.storage import base
class Alarm(base.Model):
"""
An alarm to monitor.
:param alarm_id: UUID of the alarm
:param type: type of the alarm
:param name: The Alarm name
:param description: User friendly description of the alarm
:param enabled: Is the alarm enabled
:param state: Alarm state (ok/alarm/insufficient data)
:param state_reason: Alarm state reason
:param rule: A rule that defines when the alarm fires
:param user_id: the owner/creator of the alarm
:param project_id: the project_id of the creator
:param evaluation_periods: the number of periods
:param period: the time period in seconds
:param time_constraints: the list of the alarm's time constraints, if any
:param timestamp: the timestamp when the alarm was last updated
:param state_timestamp: the timestamp of the last state change
:param ok_actions: the list of webhooks to call when entering the ok state
:param alarm_actions: the list of webhooks to call when entering the alarm state
:param insufficient_data_actions: the list of webhooks to call when entering the insufficient data state
:param repeat_actions: Is the actions should be triggered on each alarm evaluation.
:param severity: Alarm level (low/moderate/critical)
"""
/usr/lib/ python3/ dist-packages/ sqlalchemy/ engine/ default. py ------- ------- ------- ------- ------- ------- ------- --- execute( statement, parameters)
-------
do_execute, line 508: cursor.
statement=UPDATE alarm SET alarm_id= %(alarm_ id)s, enabled= %(enabled) s, name=%(name)s, type=%(type)s, severity= %(severity) s, description= %(description) s, timestamp= %(timestamp) s, user_id= %(user_ id)s, project_ id=%(project_ id)s, state=%(state)s, state_reason= %(state_ reason) s, state_timestamp =%(state_ timestamp) s, ok_actions= %(ok_actions) s, alarm_actions= %(alarm_ actions) s, insufficient_ data_actions= %(insufficient_ data_actions) s, repeat_ actions= %(repeat_ actions) s, rule=%(rule)s, time_constraint s=%(time_ constraints) s WHERE alarm.alarm_id = %(alarm_id_1)s
parameters= {'alarm_ id': 'cd47c788- 58df-4604- b21e-565d4055f8 72', 'enabled': 1, 'name': 'cpu_1', 'type': 'event', 'severity': 'low', 'description': 'Alarm when * event occurred.', 'timestamp': datetime. datetime( 2018, 10, 24, 12, 52, 55, 651317), 'user_id': 'feebe0e4f0264b ebb53b1c2468a9d a77', 'project_id': 'bc679e36e26b46 40b1392e524d176 ec2', 'state': 'alarm', 'state_reason': 'Event <id=fb7bf120- bacf-4972- 88b2-c4a750098d 67,event_ type=compute. instance. power_off. start> hits the query <query=[]>.', 'state_timestamp': datetime. datetime( 2018, 10, 24, 12, 52, 55, 651317), 'ok_actions': '[]', 'alarm_actions': '[]', 'insufficient_ data_actions' : '[]', 'repeat_actions': 0, 'rule': '{"event_type": "*", "query": []}', 'time_constraints': '[]', 'alarm_id_1': 'cd47c788- 58df-4604- b21e-565d4055f8 72'}
aodh/storage/ models. py (parameters above maps to class Alarm) ------- ------- ------- ------- ------- ------- ------- -----
-------
import datetime
from aodh.i18n import _
from aodh.storage import base
class Alarm(base.Model):
"""
An alarm to monitor.
:param alarm_id: UUID of the alarm insufficient data)
alarm state data_actions: the list of webhooks to call when
entering the insufficient data state
alarm evaluation. critical)
:param type: type of the alarm
:param name: The Alarm name
:param description: User friendly description of the alarm
:param enabled: Is the alarm enabled
:param state: Alarm state (ok/alarm/
:param state_reason: Alarm state reason
:param rule: A rule that defines when the alarm fires
:param user_id: the owner/creator of the alarm
:param project_id: the project_id of the creator
:param evaluation_periods: the number of periods
:param period: the time period in seconds
:param time_constraints: the list of the alarm's time constraints, if any
:param timestamp: the timestamp when the alarm was last updated
:param state_timestamp: the timestamp of the last state change
:param ok_actions: the list of webhooks to call when entering the ok state
:param alarm_actions: the list of webhooks to call when entering the
:param insufficient_
:param repeat_actions: Is the actions should be triggered on each
:param severity: Alarm level (low/moderate/
"""