From 2f7163a0a4943d6dc1581b683370423cdfc80225 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 12 Feb 2020 20:59:18 +0500 Subject: [PATCH 1/2] Add promote_affected_tt param to AlarmEscalation config. --- fm/models/alarmescalation.py | 1 + services/escalator/escalation.py | 33 ++++++++++++------------ ui/web/fm/alarmescalation/Application.js | 7 +++++ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/fm/models/alarmescalation.py b/fm/models/alarmescalation.py index 762e989447..faf61635eb 100644 --- a/fm/models/alarmescalation.py +++ b/fm/models/alarmescalation.py @@ -65,6 +65,7 @@ class EscalationItem(EmbeddedDocument): clear_template = ForeignKeyField(Template) create_tt = BooleanField(default=False) promote_group_tt = BooleanField(default=True) + promote_affected_tt = BooleanField(default=True) close_tt = BooleanField(default=False) wait_tt = BooleanField(default=False) # Stop or continue to next rule diff --git a/services/escalator/escalation.py b/services/escalator/escalation.py index 63b179fa3f..7415875e70 100644 --- a/services/escalator/escalation.py +++ b/services/escalator/escalation.py @@ -206,28 +206,29 @@ def escalate(alarm_id, escalation_id, escalation_delay, login="correlator", *arg log("Promoting to group tt") gtt = tts.create_group_tt(tt_id, alarm.timestamp) # Append affected objects - for ao in alarm.iter_affected(): - if ao.can_escalate(True): - if ao.tt_system == mo.tt_system: - log("Appending object %s to group tt %s", ao.name, gtt) - try: - tts.add_to_group_tt(gtt, ao.tt_system_id) - except TTError as e: - alarm.set_escalation_error( - "[%s] %s" % (mo.tt_system.name, e) + if tts.promote_affected_tt: + for ao in alarm.iter_affected(): + if ao.can_escalate(True): + if ao.tt_system == mo.tt_system: + log("Appending object %s to group tt %s", ao.name, gtt) + try: + tts.add_to_group_tt(gtt, ao.tt_system_id) + except TTError as e: + alarm.set_escalation_error( + "[%s] %s" % (mo.tt_system.name, e) + ) + else: + log( + "Cannot append object %s to group tt %s: Belongs to other TT system", + ao.name, + gtt, ) else: log( - "Cannot append object %s to group tt %s: Belongs to other TT system", + "Cannot append object %s to group tt %s: Escalations are disabled", ao.name, gtt, ) - else: - log( - "Cannot append object %s to group tt %s: Escalations are disabled", - ao.name, - gtt, - ) metrics["escalation_tt_create"] += 1 except TTError as e: log("Failed to create TT: %s", e) diff --git a/ui/web/fm/alarmescalation/Application.js b/ui/web/fm/alarmescalation/Application.js index 95e9e5ba68..abe1685416 100644 --- a/ui/web/fm/alarmescalation/Application.js +++ b/ui/web/fm/alarmescalation/Application.js @@ -165,6 +165,13 @@ Ext.define("NOC.fm.alarmescalation.Application", { width: 50, renderer: NOC.render.Bool }, + { + text: __("ATT"), + dataIndex: "promote_affected_tt", + editor: "checkboxfield", + width: 50, + renderer: NOC.render.Bool + }, { text: __("Wait TT"), dataIndex: "wait_tt", -- GitLab From b8152bc091f809dcecf799c75c19c33cb72750a1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 12 Feb 2020 21:25:25 +0500 Subject: [PATCH 2/2] Fix black. --- services/escalator/escalation.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/escalator/escalation.py b/services/escalator/escalation.py index 7415875e70..2da85e34e5 100644 --- a/services/escalator/escalation.py +++ b/services/escalator/escalation.py @@ -210,7 +210,11 @@ def escalate(alarm_id, escalation_id, escalation_delay, login="correlator", *arg for ao in alarm.iter_affected(): if ao.can_escalate(True): if ao.tt_system == mo.tt_system: - log("Appending object %s to group tt %s", ao.name, gtt) + log( + "Appending object %s to group tt %s", + ao.name, + gtt, + ) try: tts.add_to_group_tt(gtt, ao.tt_system_id) except TTError as e: -- GitLab