From 15085c8a053592aa1364c8b3145aeb0d51aff7b4 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Fri, 31 May 2024 13:54:06 +0200 Subject: [PATCH] Enable Grafana email alerts Allows sending Grafana alerts via email too, so we have a reduntant mechanism in case Slack fails to deliver them. Reviewed-by: Aleix Roca Nonell --- m/hut/monitoring.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/m/hut/monitoring.nix b/m/hut/monitoring.nix index b08730f..8f0d5fa 100644 --- a/m/hut/monitoring.nix +++ b/m/hut/monitoring.nix @@ -3,6 +3,12 @@ { imports = [ ../module/slurm-exporter.nix ]; + age.secrets.grafanaJungleRobotPassword = { + file = ../../secrets/jungle-robot-password.age; + owner = "grafana"; + mode = "400"; + }; + services.grafana = { enable = true; settings = { @@ -13,6 +19,16 @@ http_port = 2342; http_addr = "127.0.0.1"; }; + smtp = { + enabled = true; + from_address = "jungle-robot@bsc.es"; + user = "jungle-robot"; + # Read the password from a file, which is only readable by grafana user + # https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#file-provider + password = "$__file{${config.age.secrets.grafanaJungleRobotPassword.path}}"; + host = "mail.bsc.es:465"; + startTLS_policy = "NoStartTLS"; + }; feature_toggles.publicDashboards = true; "auth.anonymous".enabled = true; };