modules/monitoring: fix probes

This commit is contained in:
xinyangli 2024-12-06 23:25:44 +08:00
parent 082e64b960
commit e4fd9e8b23
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
3 changed files with 35 additions and 2 deletions

View file

@ -44,6 +44,7 @@
custom.prometheus.exporters = { custom.prometheus.exporters = {
enable = true; enable = true;
node.enable = true;
}; };
services.tailscale.enable = true; services.tailscale.enable = true;

View file

@ -67,10 +67,18 @@ in
let let
probeList = [ probeList = [
"la-00.video.namely.icu:8080" "la-00.video.namely.icu:8080"
"fre-00.video.namely.icu:8080" "fra-00.video.namely.icu:8080"
"hk-00.video.namely.icu:8080" "hk-00.video.namely.icu:8080"
"home.xinyang.life:8000" "home.xinyang.life:8000"
]; ];
chinaTargets = [
"bj-cu-v4.ip.zstaticcdn.com:80"
"bj-cm-v4.ip.zstaticcdn.com:80"
"bj-ct-v4.ip.zstaticcdn.com:80"
"sh-cu-v4.ip.zstaticcdn.com:80"
"sh-cm-v4.ip.zstaticcdn.com:80"
"sh-ct-v4.ip.zstaticcdn.com:80"
];
passwordFile = config.sops.secrets."prometheus/metrics_password".path; passwordFile = config.sops.secrets."prometheus/metrics_password".path;
in in
(mkScrapes [ (mkScrapes [
@ -123,6 +131,7 @@ in
{ address = "thorite.coho-tet.ts.net"; } { address = "thorite.coho-tet.ts.net"; }
{ address = "massicot.coho-tet.ts.net"; } { address = "massicot.coho-tet.ts.net"; }
{ address = "weilite.coho-tet.ts.net"; } { address = "weilite.coho-tet.ts.net"; }
{ address = "biotite.coho-tet.ts.net"; }
{ address = "hk-00.coho-tet.ts.net"; } { address = "hk-00.coho-tet.ts.net"; }
{ address = "la-00.coho-tet.ts.net"; } { address = "la-00.coho-tet.ts.net"; }
{ address = "fra-00.coho-tet.ts.net"; } { address = "fra-00.coho-tet.ts.net"; }
@ -140,10 +149,22 @@ in
hostAddress = "weilite.coho-tet.ts.net"; hostAddress = "weilite.coho-tet.ts.net";
targetAddresses = [ targetAddresses = [
"la-00.video.namely.icu:8080" "la-00.video.namely.icu:8080"
"fre-00.video.namely.icu:8080" "fra-00.video.namely.icu:8080"
"hk-00.video.namely.icu:8080" "hk-00.video.namely.icu:8080"
]; ];
} }
{
hostAddress = "la-00.coho-tet.ts.net";
targetAddresses = chinaTargets;
}
{
hostAddress = "hk-00.coho-tet.ts.net";
targetAddresses = chinaTargets;
}
{
hostAddress = "fra-00.coho-tet.ts.net";
targetAddresses = chinaTargets;
}
]); ]);
}; };

View file

@ -237,6 +237,17 @@ in
{ {
inherit name; inherit name;
rules = [ rules = [
{
alert = "ProbeError";
expr = "probe_success != 1";
for = "3m";
labels = {
severity = "critical";
};
annotations = {
summary = "Probing {{ $labels.instance }} from {{ $labels.from }} failed";
};
}
{ {
alert = "HighProbeLatency"; alert = "HighProbeLatency";
expr = "probe_duration_seconds > 0.5"; expr = "probe_duration_seconds > 0.5";