Merge "add operational severity to alarms table"
This commit is contained in:
commit
140b631e36
@ -232,8 +232,8 @@ def _is_alarm_severity_change(before, curr):
|
||||
return False
|
||||
# returns true on activation, deactivation and severity change
|
||||
if not before and curr \
|
||||
or (before.get(VProps.VITRAGE_AGGREGATED_SEVERITY) !=
|
||||
curr.get(VProps.VITRAGE_AGGREGATED_SEVERITY)):
|
||||
or (before.get(VProps.VITRAGE_OPERATIONAL_SEVERITY) !=
|
||||
curr.get(VProps.VITRAGE_OPERATIONAL_SEVERITY)):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
@ -102,6 +102,8 @@ class VitragePersistorEndpoint(object):
|
||||
vitrage_type=data.get(VProps.VITRAGE_TYPE),
|
||||
vitrage_aggregated_severity=data.get(
|
||||
VProps.VITRAGE_AGGREGATED_SEVERITY),
|
||||
vitrage_operational_severity=data.get(
|
||||
VProps.VITRAGE_OPERATIONAL_SEVERITY),
|
||||
project_id=data.get(VProps.PROJECT_ID),
|
||||
vitrage_resource_type=data.get(VProps.VITRAGE_RESOURCE_TYPE),
|
||||
vitrage_resource_id=data.get(VProps.VITRAGE_RESOURCE_ID),
|
||||
@ -147,7 +149,7 @@ class VitragePersistorEndpoint(object):
|
||||
models.Change(
|
||||
vitrage_id=data.get(VProps.VITRAGE_ID),
|
||||
timestamp=event_timestamp,
|
||||
severity=data.get(VProps.VITRAGE_AGGREGATED_SEVERITY),
|
||||
severity=data.get(VProps.VITRAGE_OPERATIONAL_SEVERITY),
|
||||
payload=data)
|
||||
self.db.changes.create(change_row)
|
||||
|
||||
|
@ -68,15 +68,15 @@ class HistoryFacadeConnection(object):
|
||||
query, project_id, is_admin_project)
|
||||
|
||||
query_severe = query.filter(
|
||||
models.Alarm.vitrage_aggregated_severity == OSeverity.SEVERE)
|
||||
models.Alarm.vitrage_operational_severity == OSeverity.SEVERE)
|
||||
query_critical = query.filter(
|
||||
models.Alarm.vitrage_aggregated_severity == OSeverity.CRITICAL)
|
||||
models.Alarm.vitrage_operational_severity == OSeverity.CRITICAL)
|
||||
query_warning = query.filter(
|
||||
models.Alarm.vitrage_aggregated_severity == OSeverity.WARNING)
|
||||
models.Alarm.vitrage_operational_severity == OSeverity.WARNING)
|
||||
query_ok = query.filter(
|
||||
models.Alarm.vitrage_aggregated_severity == OSeverity.OK)
|
||||
models.Alarm.vitrage_operational_severity == OSeverity.OK)
|
||||
query_na = query.filter(
|
||||
models.Alarm.vitrage_aggregated_severity == OSeverity.NA)
|
||||
models.Alarm.vitrage_operational_severity == OSeverity.NA)
|
||||
|
||||
counts = {OSeverity.SEVERE: query_severe.count(),
|
||||
OSeverity.CRITICAL: query_critical.count(),
|
||||
@ -258,8 +258,8 @@ class HistoryFacadeConnection(object):
|
||||
@staticmethod
|
||||
def _add_time_frame_to_query(query, start, end):
|
||||
start = timeutils.normalize_time(start)
|
||||
end = timeutils.normalize_time(end)
|
||||
if start and end:
|
||||
end = timeutils.normalize_time(end)
|
||||
query = \
|
||||
query.filter(
|
||||
or_(and_(models.Alarm.start_timestamp >= start,
|
||||
|
@ -238,6 +238,8 @@ class Alarm(Base):
|
||||
vitrage_type = Column(String(64), nullable=False)
|
||||
vitrage_aggregated_severity = Column(String(64), index=True,
|
||||
nullable=False)
|
||||
vitrage_operational_severity = Column(String(64), index=True,
|
||||
nullable=False)
|
||||
project_id = Column(String(64), index=True)
|
||||
vitrage_resource_type = Column(String(64))
|
||||
vitrage_resource_id = Column(String(64))
|
||||
@ -253,6 +255,7 @@ class Alarm(Base):
|
||||
"name='%s'," \
|
||||
"vitrage_type='%s'," \
|
||||
"vitrage_aggregated_severity='%s'," \
|
||||
"vitrage_operational_severity='%s'," \
|
||||
"project_id='%s'," \
|
||||
"vitrage_resource_type='%s'," \
|
||||
"vitrage_resource_id='%s'," \
|
||||
@ -265,6 +268,7 @@ class Alarm(Base):
|
||||
self.name,
|
||||
self.vitrage_type,
|
||||
self.vitrage_aggregated_severity,
|
||||
self.vitrage_operational_severity,
|
||||
self.project_id,
|
||||
self.vitrage_resource_type,
|
||||
self.vitrage_resource_id,
|
||||
|
Loading…
Reference in New Issue
Block a user