diff --git a/Nagstamon/Config.py b/Nagstamon/Config.py index b9f8898eb..bd207b5f4 100644 --- a/Nagstamon/Config.py +++ b/Nagstamon/Config.py @@ -977,6 +977,9 @@ def __init__(self): self.notification_filter = "user.name=*" self.notification_lookback = "30 minutes" + # Thruk + self.disabled_backends = "" + class Action(object): """ class for custom actions, which whill be thrown into one config dictionary like the servers diff --git a/Nagstamon/QUI/__init__.py b/Nagstamon/QUI/__init__.py index 7eb881802..2a20479cf 100644 --- a/Nagstamon/QUI/__init__.py +++ b/Nagstamon/QUI/__init__.py @@ -5821,6 +5821,8 @@ def __init__(self, dialog): self.window.label_notification_filter: ['IcingaDBWebNotifications'], self.window.input_lineedit_notification_lookback: ['IcingaDBWebNotifications'], self.window.label_notification_lookback: ['IcingaDBWebNotifications'], + self.window.label_disabled_backends: ['Thruk'], + self.window.input_lineedit_disabled_backends: ['Thruk'], } # to be used when selecting authentication method Kerberos diff --git a/Nagstamon/Servers/Generic.py b/Nagstamon/Servers/Generic.py index 08a9a04df..f7ca97529 100644 --- a/Nagstamon/Servers/Generic.py +++ b/Nagstamon/Servers/Generic.py @@ -267,6 +267,9 @@ def __init__(self, **kwds): self.notification_filter = None self.notification_lookback = None + # Thruk + self.disabled_backends = None + def init_config(self): ''' set URLs for CGI - they are static and there is no need to set them with every cycle diff --git a/Nagstamon/Servers/Thruk.py b/Nagstamon/Servers/Thruk.py index 209f16223..72736fd73 100644 --- a/Nagstamon/Servers/Thruk.py +++ b/Nagstamon/Servers/Thruk.py @@ -135,6 +135,9 @@ def login(self): self.refresh_authentication = True return Result(result=None, error="Login failed") + if self.disabled_backends is not None: + self.session.cookies.set('thruk_backends', '&'.join((f"{v}=2" for v in self.disabled_backends.split(',')))) + print(self.session.cookies.get('thruk_backends')) def open_monitor(self, host, service=''): ''' diff --git a/Nagstamon/Servers/__init__.py b/Nagstamon/Servers/__init__.py index f1f595a4c..4cae56d4d 100644 --- a/Nagstamon/Servers/__init__.py +++ b/Nagstamon/Servers/__init__.py @@ -222,6 +222,9 @@ def create_server(server=None): new_server.map_to_critical = server.map_to_critical new_server.map_to_down = server.map_to_down + # Thruk + new_server.disabled_backends = server.disabled_backends + # server's individual preparations for HTTP connections (for example cookie creation) # is done in GetStatus() method of monitor if server.enabled is True: diff --git a/Nagstamon/resources/qui/settings_server.ui b/Nagstamon/resources/qui/settings_server.ui index eedf4119c..3c80c2bac 100644 --- a/Nagstamon/resources/qui/settings_server.ui +++ b/Nagstamon/resources/qui/settings_server.ui @@ -54,6 +54,19 @@ + + + + + 0 + 0 + + + + Disabled backends: + + + @@ -77,7 +90,7 @@ - + username @@ -94,7 +107,7 @@ - + 1234567890 @@ -104,6 +117,13 @@ + + + + 1234567890 + + +