From 605de7bdd65b3bfd063581b692222da78a3cd92b Mon Sep 17 00:00:00 2001 From: hagen1778 Date: Wed, 2 Feb 2022 16:18:40 +0200 Subject: [PATCH] vmalert: remove trailing slash for static notifier addresses This would make addresses `http://localhost:9093` and `http://localhost:9093/` both to result into `http://localhost:9093/api/v2/alerts`. Signed-off-by: hagen1778 --- app/vmalert/notifier/init.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/vmalert/notifier/init.go b/app/vmalert/notifier/init.go index d6dc778ef9..633cbfb24d 100644 --- a/app/vmalert/notifier/init.go +++ b/app/vmalert/notifier/init.go @@ -3,6 +3,7 @@ package notifier import ( "flag" "fmt" + "strings" "time" "github.com/VictoriaMetrics/VictoriaMetrics/lib/flagutil" @@ -93,6 +94,7 @@ func notifiersFromFlags(gen AlertURLGenerator) ([]Notifier, error) { Password: promauth.NewSecret(basicAuthPassword.GetOptionalArg(i)), }, } + addr = strings.TrimSuffix(addr, "/") am, err := NewAlertManager(addr+alertManagerPath, gen, authCfg, time.Minute) if err != nil { return nil, err