diff --git a/hosts/rico1/services/apps/alertmanager.nix b/hosts/rico1/services/apps/alertmanager.nix new file mode 100644 index 0000000..cbffd4b --- /dev/null +++ b/hosts/rico1/services/apps/alertmanager.nix @@ -0,0 +1,49 @@ +_: +let + inherit (import ../../../shared/caddy-helpers.nix) logFormat; + domainName = "alertmanager.labs.adtya.xyz"; +in +{ + services = { + caddy = { + virtualHosts."${domainName}" = { + logFormat = logFormat "${domainName}"; + extraConfig = '' + reverse_proxy 127.0.0.1:9093 + ''; + }; + }; + prometheus.alertmanager = { + enable = true; + listenAddress = "127.0.0.1"; + port = 9093; + webExternalUrl = "https://${domainName}/"; + configuration = { + route = { + group_by = [ "alertname" ]; + group_wait = "30s"; + group_interval = "5m"; + repeat_interval = "1h"; + receiver = "web.hook"; + }; + receivers = [ + { + name = "web.hook"; + webhook_configs = [ + { url = "http://127.0.0.1:5001/"; } + ]; + } + ]; + inhibit_rules = [ + { + source_match = + { severity = "critical"; }; + target_match = + { severity = "warning"; }; + equal = [ "alertname" "dev" "instance" ]; + } + ]; + }; + }; + }; +} diff --git a/hosts/rico1/services/apps/blocky.nix b/hosts/rico1/services/apps/blocky.nix index b46bf2a..ab28600 100644 --- a/hosts/rico1/services/apps/blocky.nix +++ b/hosts/rico1/services/apps/blocky.nix @@ -74,7 +74,7 @@ in "rico2.labs.adtya.xyz" = "10.10.10.12"; "wynne.labs.adtya.xyz" = "10.10.10.13"; "layne.labs.adtya.xyz" = "10.10.10.14"; - "alertmanager.labs.adtya.xyz" = "10.10.10.10"; + "alertmanager.labs.adtya.xyz" = "10.10.10.11"; "blocky.labs.adtya.xyz" = "10.10.10.11"; "frp.labs.adtya.xyz" = "10.10.10.10"; "grafana.labs.adtya.xyz" = "10.10.10.10"; diff --git a/hosts/rico1/services/apps/default.nix b/hosts/rico1/services/apps/default.nix index b01f012..9d89119 100644 --- a/hosts/rico1/services/apps/default.nix +++ b/hosts/rico1/services/apps/default.nix @@ -3,6 +3,7 @@ _: { ./adtya.xyz.nix ./proofs.nix ./wiki.nix + ./alertmanager.nix ./blocky.nix ../../../shared/prometheus-exporters.nix ../../../shared/promtail.nix