mirror of
https://github.com/kmein/niveum
synced 2026-03-19 11:31:09 +01:00
alertmanager: report on matrix
This commit is contained in:
2
secrets
2
secrets
Submodule secrets updated: 3fed684536...d621ecc885
@@ -181,6 +181,39 @@ in {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# ref https://github.com/Mic92/dotfiles/blob/f44bac5dd6970ed3fbb4feb906917331ec3c2be5/machines/eva/modules/prometheus/default.nix
|
||||||
|
systemd.services.matrix-hook = {
|
||||||
|
description = "Matrix Hook";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
environment = {
|
||||||
|
HTTP_ADDRESS = "[::1]";
|
||||||
|
HTTP_PORT = "9088";
|
||||||
|
MX_HOMESERVER = "https://matrix.4d2.org";
|
||||||
|
MX_ID = "@lakai:4d2.org";
|
||||||
|
MX_ROOMID = "!zlwCuPiCNMSxDviFzA:4d2.org";
|
||||||
|
MX_MSG_TEMPLATE = "${pkgs.matrix-hook}/message.html.tmpl";
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
EnvironmentFile = [
|
||||||
|
# format: MX_TOKEN=<token>
|
||||||
|
config.age.secrets.matrix-token-lakai-env.path
|
||||||
|
];
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${pkgs.matrix-hook}/bin/matrix-hook";
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = "10";
|
||||||
|
DynamicUser = true;
|
||||||
|
User = "matrix-hook";
|
||||||
|
Group = "matrix-hook";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
age.secrets = {
|
||||||
|
matrix-token-lakai-env.file = ../../../secrets/matrix-token-lakai-env.age;
|
||||||
|
};
|
||||||
|
|
||||||
services.prometheus.alertmanager = {
|
services.prometheus.alertmanager = {
|
||||||
enable = true;
|
enable = true;
|
||||||
listenAddress = "localhost";
|
listenAddress = "localhost";
|
||||||
@@ -190,39 +223,17 @@ in {
|
|||||||
route = {
|
route = {
|
||||||
group_wait = "30s";
|
group_wait = "30s";
|
||||||
repeat_interval = "24h";
|
repeat_interval = "24h";
|
||||||
receiver = "all";
|
receiver = "matrix";
|
||||||
};
|
};
|
||||||
receivers = [
|
receivers = [
|
||||||
{
|
{
|
||||||
name = "all";
|
name = "matrix";
|
||||||
telegram_configs = [
|
webhook_configs = [
|
||||||
{
|
{
|
||||||
bot_token = "$TELEGRAM_TOKEN";
|
url = "http://localhost:9088/alert";
|
||||||
chat_id = 18980945;
|
max_alerts = 5;
|
||||||
parse_mode = "";
|
|
||||||
api_url = "https://api.telegram.org";
|
|
||||||
send_resolved = true;
|
|
||||||
message = ''
|
|
||||||
{{range .Alerts -}}
|
|
||||||
{{ .Status }}: {{ index .Annotations "summary" }}
|
|
||||||
{{end -}}
|
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
email_configs = let
|
|
||||||
inherit (import ../../../lib) kieran;
|
|
||||||
inherit (import ../../../lib/email.nix {inherit lib;}) cock;
|
|
||||||
cockConfig = {
|
|
||||||
send_resolved = true;
|
|
||||||
to = kieran.email;
|
|
||||||
from = cock.user;
|
|
||||||
smarthost = "${cock.smtp}:587";
|
|
||||||
auth_username = cock.user;
|
|
||||||
auth_identity = cock.user;
|
|
||||||
auth_password = "$EMAIL_PASSWORD";
|
|
||||||
};
|
|
||||||
in [
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user