alertmanager pain

This commit is contained in:
chris 2025-04-14 23:37:55 +02:00
commit c0241036c6
Signed by: c6ristian
SSH key fingerprint: SHA256:B3m+yzpaxGXSEcDBpPHfvza/DNC0wuX+CKMeGq8wgak
8 changed files with 413 additions and 94 deletions

View file

@ -17,8 +17,11 @@ let
mkdir $out
cp -R $src $out/anonymous/
'';
template_alert = ./templates;
in
{
environment.etc."alertmanager/templates".source = template_alert;
services.mimir = {
enable = true;
configuration = {
@ -36,7 +39,6 @@ in
server = {
http_listen_port = 9009;
http_listen_address = "127.0.0.1";
log_level = "warn";
grpc_listen_port = 9096;
grpc_listen_address = "127.0.0.1";
};
@ -61,9 +63,32 @@ in
replication_factor = 1;
instance_addr = "127.0.0.1";
};
utf8_strict_mode = true;
fallback_config_file = pkgs.writers.writeYAML "alertmanager.yaml" {
route = {
group_by = ["alertname"];
receiver = "telegram";
group_wait = "30s";
group_interval = "1m";
repeat_interval = "3m";
};
receivers = [
{
name = "telegram";
telegram_configs = [{
bot_token_file = config.sops.secrets."services/telegrambot/token".path;
chat_id = -1002579132187;
}];
}
];
templates = [
"/etc/alertmanager/templates/*.tmpl"
];
};
};
ruler = {
alertmanager_url = "http://localhost/alertmanager";
ring = {
instance_addr = "127.0.0.1";
};
@ -90,6 +115,16 @@ in
proxyPass = "http://mimir";
basicAuthFile = config.sops.secrets."services/mimir/nginx".path;
};
locations."/" = {
proxyPass = "http://mimir/";
basicAuthFile = config.sops.secrets."services/mimir/nginx".path;
};
};
virtualHosts."localhost" = {
locations."/" = {
proxyPass = "http://mimir/";
};
};
};
}