From d03be78a637cf9138aa86a24ff16f3df64688496 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Tue, 5 Mar 2024 21:50:43 +0100 Subject: [PATCH] enable email alerting in gatus --- nix/modules/monitoring/default.nix | 14 ++++++++++++++ nix/modules/monitoring/gatus-endpoints.nix | 9 +++++++-- .../networking/dmz_services/zones/kun.is.nix | 12 ++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/nix/modules/monitoring/default.nix b/nix/modules/monitoring/default.nix index 49267ed..bc9099b 100644 --- a/nix/modules/monitoring/default.nix +++ b/nix/modules/monitoring/default.nix @@ -58,6 +58,20 @@ in settings = { web.port = 4242; endpoints = import ./gatus-endpoints.nix; + + alerting.email = { + from = "gatus@kun.is"; + host = "mail.smtp2go.com"; + port = 2525; + to = "pim@kunis.nl"; + client.insecure = true; + default-alert = { + enabled = true; + failure-threshold = 2; + success-threshold = 1; + send-on-resolved = true; + }; + }; }; }; }; diff --git a/nix/modules/monitoring/gatus-endpoints.nix b/nix/modules/monitoring/gatus-endpoints.nix index 3aae24d..92a7f66 100644 --- a/nix/modules/monitoring/gatus-endpoints.nix +++ b/nix/modules/monitoring/gatus-endpoints.nix @@ -20,7 +20,7 @@ let "[BODY].installed == true" "[BODY].maintenance == false" "[BODY].needsDbUpgrade == false" - (maxResponseTime 750) + (maxResponseTime 1000) ]; } { @@ -184,4 +184,9 @@ let } ]; in -map (endpoint: endpoint // { interval = "5m"; }) endpoints +map + (endpoint: endpoint // { + interval = "5m"; + alerts = [{ type = "email"; }]; + }) + endpoints diff --git a/nix/modules/networking/dmz_services/zones/kun.is.nix b/nix/modules/networking/dmz_services/zones/kun.is.nix index a527c96..a13c443 100644 --- a/nix/modules/networking/dmz_services/zones/kun.is.nix +++ b/nix/modules/networking/dmz_services/zones/kun.is.nix @@ -21,6 +21,10 @@ in (mx.mx 10 "mail.kun.is.") ]; + TXT = [ + (with spf; soft [ "include:spf.glasnet.nl" ]) + ]; + subdomains = { "*" = { A = [ cfg.public.ipv4.router ]; @@ -60,17 +64,17 @@ in AAAA = [ cfg.dmz.ipv6.router ]; }; -#for SMTP2GO to be able send emails from kun.is domain + #for SMTP2GO to be able send emails from kun.is domain em670271 = { - CNAME = ["return.smtp2go.net."]; + CNAME = [ "return.smtp2go.net." ]; }; "s670271._domainkey" = { - CNAME = ["dkim.smtp2go.net."]; + CNAME = [ "dkim.smtp2go.net." ]; }; link = { - CNAME = ["track.smtp2go.net."]; + CNAME = [ "track.smtp2go.net." ]; }; };