Skip to content

Commit

Permalink
Add map to down for Alertmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
LS132 committed Nov 15, 2023
1 parent 31cfcd1 commit 40f31ba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions Nagstamon/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,7 @@ def __init__(self):
self.alertmanager_filter = ''
self.map_to_critical = 'critical,error'
self.map_to_warning = 'warning,warn'
self.map_to_down = 'down'
self.map_to_unknown = 'unknown'
self.map_to_ok = 'ok'

Expand Down
2 changes: 2 additions & 0 deletions Nagstamon/QUI/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5815,6 +5815,8 @@ def __init__(self, dialog):
self.window.input_lineedit_map_to_warning: ['Alertmanager'],
self.window.label_map_to_critical: ['Alertmanager'],
self.window.input_lineedit_map_to_critical: ['Alertmanager'],
self.window.label_map_to_down: ['Alertmanager'],
self.window.input_lineedit_map_to_down: ['Alertmanager'],
self.window.input_lineedit_notification_filter: ['IcingaDBWebNotifications'],
self.window.label_notification_filter: ['IcingaDBWebNotifications'],
self.window.input_lineedit_notification_lookback: ['IcingaDBWebNotifications'],
Expand Down
5 changes: 5 additions & 0 deletions Nagstamon/Servers/Alertmanager/alertmanagerserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class AlertmanagerServer(GenericServer):
map_to_status_information = ''
map_to_critical = ''
map_to_warning = ''
map_to_down = ''
map_to_unknown = ''
map_to_ok = ''
name = ''
Expand Down Expand Up @@ -96,6 +97,8 @@ def map_severity(self, the_severity):
return "CRITICAL"
if the_severity in self.map_to_warning.split(','):
return "WARNING"
if the_severity in self.map_to_down.split(','):
return "DOWN"
if the_severity in self.map_to_ok.split(','):
return "OK"
return the_severity.upper()
Expand Down Expand Up @@ -183,6 +186,8 @@ def _get_status(self):
self.map_to_critical)
log.debug("severity config (map_to_warning): '%s'",
self.map_to_warning)
log.debug("severity config (map_to_down): '%s'",
self.map_to_down)
log.debug("severity config (map_to_ok): '%s'",
self.map_to_ok)

Expand Down
10 changes: 10 additions & 0 deletions Nagstamon/resources/qui/settings_server.ui
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,9 @@
<widget class="QLineEdit" name="input_lineedit_map_to_critical"/>
</item>
<item row="19" column="2" colspan="2">
<widget class="QLineEdit" name="input_lineedit_map_to_down"/>
</item>
<item row="20" column="2" colspan="2">
<widget class="QLineEdit" name="input_lineedit_map_to_unknown"/>
</item>
<item row="16" column="1">
Expand All @@ -761,6 +764,13 @@
</widget>
</item>
<item row="19" column="1">
<widget class="QLabel" name="label_map_to_down">
<property name="text">
<string>Map to DOWN</string>
</property>
</widget>
</item>
<item row="20" column="1">
<widget class="QLabel" name="label_map_to_unknown">
<property name="text">
<string>Map to UNKNOWN</string>
Expand Down

0 comments on commit 40f31ba

Please sign in to comment.