{ config, ... }: let synapseCfg = config.services.matrix-synapse; in { services.go-neb = rec { enable = true; bindAddress = "127.0.0.1:8010"; baseUrl = "http://${bindAddress}"; config = { clients = [ ({ UserID = "@alertmanager:${synapseCfg.server_name}"; HomeserverURL = synapseCfg.public_baseurl; Sync = false; AutoJoinRooms = false; DisplayName = "Prometheus Alertmanager"; } // (import ../../secrets/go-neb-alertmanager.nix)) # AccessToken and DeviceID ]; services = [ { ID = "alertmanager_service"; Type = "alertmanager"; UserID = "@alertmanager:${synapseCfg.server_name}"; Config = { webhook_url = "${baseUrl}/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2U"; rooms = { "!ceigaGYfREXXSeLFiH:sbruder.de" = { text_template = "{{ range .Alerts }}[{{ .Status }}] {{ index .Labels \"alertname\" }}: {{ index .Annotations \"description\" }}\n{{ end }}"; html_template = '' {{ range .Alerts }} {{ $severity := index .Labels "severity" }} {{ if eq .Status "firing" -}} [firing{{ if ne $severity "" }} - {{ $severity }}{{ end }}] {{- else -}} [resolved] {{- end }} {{ index .Labels "alertname" }}: {{ index .Annotations "description" }} source
{{ end }} ''; msg_type = "m.text"; }; }; }; } ]; }; }; }