rico1: add alertmanager

This commit is contained in:
Adithya 2024-10-27 18:35:53 +05:30
parent e1556fa6cb
commit 139fb1816e
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
3 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,49 @@
_:
let
inherit (import ../../../shared/caddy-helpers.nix) logFormat;
domainName = "alertmanager.labs.adtya.xyz";
in
{
services = {
caddy = {
virtualHosts."${domainName}" = {
logFormat = logFormat "${domainName}";
extraConfig = ''
reverse_proxy 127.0.0.1:9093
'';
};
};
prometheus.alertmanager = {
enable = true;
listenAddress = "127.0.0.1";
port = 9093;
webExternalUrl = "https://${domainName}/";
configuration = {
route = {
group_by = [ "alertname" ];
group_wait = "30s";
group_interval = "5m";
repeat_interval = "1h";
receiver = "web.hook";
};
receivers = [
{
name = "web.hook";
webhook_configs = [
{ url = "http://127.0.0.1:5001/"; }
];
}
];
inhibit_rules = [
{
source_match =
{ severity = "critical"; };
target_match =
{ severity = "warning"; };
equal = [ "alertname" "dev" "instance" ];
}
];
};
};
};
}

View file

@ -74,7 +74,7 @@ in
"rico2.labs.adtya.xyz" = "10.10.10.12"; "rico2.labs.adtya.xyz" = "10.10.10.12";
"wynne.labs.adtya.xyz" = "10.10.10.13"; "wynne.labs.adtya.xyz" = "10.10.10.13";
"layne.labs.adtya.xyz" = "10.10.10.14"; "layne.labs.adtya.xyz" = "10.10.10.14";
"alertmanager.labs.adtya.xyz" = "10.10.10.10"; "alertmanager.labs.adtya.xyz" = "10.10.10.11";
"blocky.labs.adtya.xyz" = "10.10.10.11"; "blocky.labs.adtya.xyz" = "10.10.10.11";
"frp.labs.adtya.xyz" = "10.10.10.10"; "frp.labs.adtya.xyz" = "10.10.10.10";
"grafana.labs.adtya.xyz" = "10.10.10.10"; "grafana.labs.adtya.xyz" = "10.10.10.10";

View file

@ -3,6 +3,7 @@ _: {
./adtya.xyz.nix ./adtya.xyz.nix
./proofs.nix ./proofs.nix
./wiki.nix ./wiki.nix
./alertmanager.nix
./blocky.nix ./blocky.nix
../../../shared/prometheus-exporters.nix ../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix ../../../shared/promtail.nix