From 3bc32e1cfdb22c5549674b470f996bd27438f542 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Sat, 24 Feb 2024 08:14:41 +0100 Subject: [PATCH] Make grafana alert settings proper --- hosts/nixos/lapetus/services/grafana.nix | 33 +++++++++++++++++------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/hosts/nixos/lapetus/services/grafana.nix b/hosts/nixos/lapetus/services/grafana.nix index 97e844c..c699c97 100644 --- a/hosts/nixos/lapetus/services/grafana.nix +++ b/hosts/nixos/lapetus/services/grafana.nix @@ -36,16 +36,29 @@ in provision = { enable = true; - alerting.contactPoints.settings.contactPoints = [ - { name = "email"; } - { - name = "discord"; - webhook_configs = [{ - send_resolved = true; - url = secret "grafana_discord_webhook"; - }]; - } - ]; + # https://grafana.com/docs/grafana/latest/alerting/set-up/provision-alerting-resources/file-provisioning/ + alerting.contactPoints.settings = { + deleteContactPoints = [ + { uid = "main_discord"; } + { uid = "main_email"; } + ]; + + contactPoints = [{ + name = "main"; + receivers = [ + { + uid = "main_discord"; + type = "discord"; + settings.url = secret "grafana_discord_webhook"; + } + { + uid = "main_email"; + type = "email"; + settings.addresses = "colimit@moonythm.dev"; + } + ]; + }]; + }; datasources.settings.datasources = [{ name = "Prometheus";