From: Tatjana Dehler Date: Thu, 7 Jul 2022 15:21:14 +0000 (+0200) Subject: mgr/dashboard: prevent alert redirect X-Git-Tag: v16.2.11~428^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F47145%2Fhead;p=ceph.git mgr/dashboard: prevent alert redirect Prevent Alertmanager alerts from being redirected to the active mgr dashboard instance. There are two reasons for it: 1. It doesn't bring any additional benefit. The Alertmanager config includes all available mgr instances - active and passive ones. In case of an alert, it will be sent to all of them. It ensures that the active mgr dashboard will receive the alert in any case. 2. The redirect URL includes the mgr IP and NOT the FQDN. This leads to issues in environments where an SSL certificate is configured and matches the FQDNs, only. Fixes: https://tracker.ceph.com/issues/56401 Signed-off-by: Tatjana Dehler (cherry picked from commit 965005e0789e566ccadce7a326b0e197ab8d7f5f) --- diff --git a/src/pybind/mgr/dashboard/module.py b/src/pybind/mgr/dashboard/module.py index 96e447c6d928..9d3b0ee5b2c4 100644 --- a/src/pybind/mgr/dashboard/module.py +++ b/src/pybind/mgr/dashboard/module.py @@ -511,6 +511,13 @@ class StandbyModule(MgrStandbyModule, CherryPyConfig): def default(self, *args, **kwargs): if module.get_module_option('standby_behaviour', 'redirect') == 'redirect': active_uri = module.get_active_uri() + + if cherrypy.request.path_info.startswith('/api/prometheus_receiver'): + module.log.debug("Suppressed redirecting alert to active '%s'", + active_uri) + cherrypy.response.status = 204 + return None + if active_uri: module.log.info("Redirecting to active '%s'", active_uri) raise cherrypy.HTTPRedirect(active_uri)