Verified Commit 84413429 authored by MaksimSmile13's avatar MaksimSmile13 Committed by Andrey Vertiprahov
Browse files

Fix Calculate Alarm Severity

Исправлеие подсчета веса аварии.
В текущей реализации, подсчет веса аварии идет за счет сервисов и подписчиков. Не увсех пользоваталей есть данный функционал, в следствии чего аварии красятся всегда одним цетом. Красным.

Данный фикс проверяет наличие сервисов и подписчиков.
parent 28cda692
Pipeline #34350 failed with stages
in 1 minute and 32 seconds
......@@ -550,7 +550,7 @@ class ActiveAlarm(Document):
self.total_objects = obj_list
self.total_services = svc_list
self.total_subscribers = sub_list
if ns != self.severity:
if (services or subscribers) and ns != self.severity:
self.change_severity(severity=ns, to_save=False)
self.safe_save()
......
......@@ -418,8 +418,14 @@ class CorrelatorService(TornadoService):
self.refresh_alarm(alarm, timestamp)
return alarm
# Calculate alarm coverage
severity = r.alarm_class.default_severity.severity
summary = ServiceSummary.get_object_summary(managed_object)
summary["object"] = {managed_object.object_profile.id: 1}
sum_check = summary.copy()
sum_check.pop("object")
if any(sum_check.values()):
self.logger.info("If summary %s, calculated alarm severity" % summary)
severity = max(ServiceSummary.get_severity(summary), 1)
#
severity = max(ServiceSummary.get_severity(summary), 1)
# @todo: Fix
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment