fix(youko): probe transmission over TCP to avoid its brute-force lockout

Assisted-by: DeepSeek Harness (claude-opus-5-5)
This commit is contained in:
Ryan Yin committed 2026-11-21 13:54:24 +08:00
1 parent 8cb31f449e
commit 7576a30c87
1 file changed
+43 -14
@@ -7,11 +7,32 @@
let
cfg = config.services.prometheus.exporters.blackbox;
# Unauthenticated probes count as failed logins and trip transmission's
# anti-brute-force lockout, so its RPC port is probed over TCP instead.
httpsExcluded = [ "transmission.writefor.fun" ];
# Every named caddy vhost on this host; the `*.writefor.fun` catch-all only
# answers 404.
httpsTargets = map (name: "https://${name}/") (
lib.filter (name: !lib.hasPrefix "*." name) (lib.attrNames config.services.caddy.virtualHosts)
lib.filter (name: !lib.hasPrefix "*." name && !lib.elem name httpsExcluded) (
lib.attrNames config.services.caddy.virtualHosts
)
);
relabelToExporter = [
{
source_labels = [ "__address__" ];
target_label = "__param_target";
}
{
source_labels = [ "__param_target" ];
target_label = "instance";
}
{
target_label = "__address__";
replacement = "127.0.0.1:${toString cfg.port}";
}
];
in
{
# https://github.com/prometheus/blackbox_exporter/blob/master/CONFIGURATION.md
@@ -27,8 +48,8 @@ in
preferred_ip_protocol = "ip4";
ip_protocol_fallback = false;
fail_if_not_ssl = true;
# 401/403 come from the backend's own auth (restic, s3, webdav,
# transmission), so caddy and the service are both up.
# 401/403 come from the backend's own auth (restic, s3, webdav),
# so caddy and the service are both up.
valid_status_codes = [
200
401
@@ -36,6 +57,10 @@ in
];
};
};
modules.tcp_up = {
prober = "tcp";
timeout = "10s";
};
};
};
@@ -55,20 +80,24 @@ in
labels.cluster = "homelab";
}
];
relabel_configs = [
relabel_configs = relabelToExporter;
}
{
job_name = "blackbox-tcp";
scrape_interval = "60s";
metrics_path = "/probe";
params.module = [ "tcp_up" ];
static_configs = [
{
source_labels = [ "__address__" ];
target_label = "__param_target";
}
{
source_labels = [ "__param_target" ];
target_label = "instance";
}
{
target_label = "__address__";
replacement = "127.0.0.1:${toString cfg.port}";
targets = [ "192.168.5.118:9091" ];
labels.type = "probe";
labels.app = "transmission";
labels.host = "youko";
labels.env = "homelab";
labels.cluster = "homelab";
}
];
relabel_configs = relabelToExporter;
}
];
}