ready for runners
This commit is contained in:
parent
fc9971ddc9
commit
7dd5043b5d
49 changed files with 2569 additions and 1085 deletions
59
nixos/hosts/monitoring/alertmanager.nix
Normal file
59
nixos/hosts/monitoring/alertmanager.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ config, pkgs, modulesPath, lib, ... }:
|
||||
|
||||
{
|
||||
services.prometheus.alertmanagers = [ {
|
||||
scheme = "http";
|
||||
# path_prefix = "/alertmanager";
|
||||
static_configs = [ {
|
||||
targets = [
|
||||
"localhost:9093"
|
||||
];
|
||||
} ];
|
||||
} ];
|
||||
services.prometheus.alertmanager = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
webExternalUrl = "http://monitor.lab:9093"; # optional but helpful
|
||||
configuration = {
|
||||
route = {
|
||||
group_wait = "10s";
|
||||
group_interval = "30s";
|
||||
repeat_interval = "30m";
|
||||
receiver = "telegram";
|
||||
|
||||
routes = [
|
||||
{
|
||||
receiver = "telegram";
|
||||
group_wait = "10s";
|
||||
match_re = {
|
||||
severity = "critical|warning";
|
||||
};
|
||||
continue = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
receivers = [
|
||||
{
|
||||
name = "telegram";
|
||||
telegram_configs = [
|
||||
{
|
||||
api_url = "https://api.telegram.org";
|
||||
bot_token = config.sops.secrets."telegram-alert-bot-token".path;
|
||||
chat_id = -1002642560007;
|
||||
message_thread_id = 4;
|
||||
parse_mode = "HTML";
|
||||
send_resolved = false;
|
||||
message = "{{ template \"telegram.message\". }}";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
templates = [
|
||||
(pkgs.writeText "telegram.tmpl" (builtins.readFile ./provisioning/templates/telegram.tmpl))
|
||||
(pkgs.writeText "telegram.markdown.v2.tmpl" (builtins.readFile ./provisioning/templates/telegram.markdown.v2.tmpl))
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue