diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 2187b37f04..8742d9bbd8 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -206,7 +206,7 @@ in { - name: valve_index rules: - alert: ValveIndexInStock - expr: valve_index_in_stock == 0 + expr: valve_index_in_stock > 0 for: 1s labels: severity: page @@ -225,10 +225,8 @@ in { }; receivers = [{ name = "default-receiver"; - slack_configs = [{ - send_resolved = true; - api_url = secrets.monitoring.alertmanager.discord.api_url; - channel = "#alerts"; + webhook_configs = [{ + url = "http://localhost:9997"; }]; }]; }; @@ -296,5 +294,22 @@ in { }; my.prometheus.additionalExporterPorts.valveindexinstock = 9998; + systemd.services.alertmanager-discord = { + enable = true; + serviceConfig = { + ExecStart = "${depot.pkgs.alertmanager-discord}/bin/alertmanager-discord -listen.address 127.0.0.1:9997"; + EnvironmentFile = pkgs.writeText "discord-secret" '' + DISCORD_WEBHOOK=${secrets.monitoring.alertmanager.discord.api_url} + ''; + DynamicUser = true; + MountAPIVFS = true; + PrivateTmp = true; + PrivateUsers = true; + ProtectControlGroups = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + }; + }; + system.stateVersion = "20.03"; }