2022-03-08 01:42:46 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: {
|
2020-09-16 15:39:44 +00:00
|
|
|
#imports = [ modules/go-neb.nix ];
|
2020-06-02 00:06:20 +00:00
|
|
|
|
|
|
|
services.go-neb = {
|
|
|
|
enable = true;
|
|
|
|
baseUrl = "http://localhost";
|
|
|
|
config = {
|
2022-03-08 01:42:46 +00:00
|
|
|
clients = [
|
|
|
|
{
|
|
|
|
UserId = "@marabot:maralorn.de";
|
|
|
|
AccessToken = pkgs.privateValue "" "matrix/marabot-token";
|
|
|
|
HomeServerUrl = "https://matrix.maralorn.de";
|
|
|
|
Sync = true;
|
|
|
|
AutoJoinRooms = true;
|
|
|
|
DisplayName = "marabot";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
realms = [];
|
|
|
|
sessions = [];
|
2020-06-02 00:06:20 +00:00
|
|
|
services = [
|
|
|
|
{
|
|
|
|
ID = "alertmanager_service";
|
|
|
|
Type = "alertmanager";
|
|
|
|
UserId = "@marabot:maralorn.de";
|
|
|
|
Config = {
|
2022-03-08 01:42:46 +00:00
|
|
|
webhook_url = "http://localhost:4050/services/hooks/YWxlcnRtYW5hZ2VyX3NlcnZpY2UK";
|
2020-06-02 00:06:20 +00:00
|
|
|
rooms = {
|
|
|
|
"!negVsngnYOmXYCLKiO:maralorn.de" = {
|
|
|
|
text_template = ''
|
2020-06-02 03:07:23 +00:00
|
|
|
{{range .Alerts -}} [{{ .Status }}] {{index .Annotations "description"}} ({{index .Labels "alertname" }}){{ end -}}'';
|
2020-06-02 00:06:20 +00:00
|
|
|
html_template = ''
|
2020-06-02 03:01:10 +00:00
|
|
|
{{range .Alerts -}}{{ $severity := index .Labels "severity" }}{{ if eq .Status "firing" }}{{ if eq $severity "critical"}}<font color='red'><b>[FIRING - CRITICAL]</b></font>{{ else if eq $severity "warning"}}<font color='orange'><b>[FIRING - WARNING]</b></font>{{ else }}<font color='yellow'><b>[FIRING - {{ $severity }}]</b></font>{{ end }}{{ else }}<font color='green'><b>[RESOLVED]</b></font>{{ end }} {{ index .Annotations "description"}} {{ $url := index .Labels "url" }}{{ if eq $url "" }}{{ else }}<a href="{{ $url }}">more infos</a> {{ end }}({{ index .Labels "alertname"}}, <a href="https://stats.maralorn.de/d/health-status">dashboard</a>, <a href="{{ .SilenceURL }}">silence</a>)<br/>{{end -}}
|
2021-05-18 14:33:28 +00:00
|
|
|
'';
|
2020-06-02 00:06:20 +00:00
|
|
|
msg_type = "m.text"; # Must be either `m.text` or `m.notice`
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|