From e92c987dc3c1dbdc5c6ed3a5335bcd8a87d50a5f Mon Sep 17 00:00:00 2001 From: Roman Khavronenko Date: Tue, 21 Dec 2021 20:25:47 +0200 Subject: [PATCH] vmalert: check if remoteWrite is configured for replay mode (#1990) * vmalert: check if remoteWrite is configured for replay mode The purpose of `replay` mode is to backfill results of recording or alerting rules. So `remoteWrite.url` should be required. Otherwise, process can fail on attempt to send data. Signed-off-by: hagen1778 * Update app/vmalert/main.go Co-authored-by: Aliaksandr Valialkin --- app/vmalert/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/vmalert/main.go b/app/vmalert/main.go index 540ff27ff..5fdeb811d 100644 --- a/app/vmalert/main.go +++ b/app/vmalert/main.go @@ -97,6 +97,9 @@ func main() { if err != nil { logger.Fatalf("failed to init remoteWrite: %s", err) } + if rw == nil { + logger.Fatalf("remoteWrite.url can't be empty in replay mode") + } notifier.InitTemplateFunc(eu) groupsCfg, err := config.Parse(*rulePath, *validateTemplates, *validateExpressions) if err != nil {