fix: update Blackbox Exporter scrape config and Grafana alert expressions for improved monitoring accuracy

This commit is contained in:
2025-06-01 09:08:36 +02:00
parent f1ea4b9b20
commit faad280aa0
3 changed files with 25 additions and 19 deletions

View File

@@ -33,23 +33,30 @@ in {
# Add scrape config for VictoriaMetrics agent # Add scrape config for VictoriaMetrics agent
services.victoriametrics.extraScrapeConfigs = [ services.victoriametrics.extraScrapeConfigs = [
'' ''
- job_name: "blackbox_http_all_domains" - job_name: "blackbox_http_all_domains"
metrics_path: "/probe" metrics_path: "/probe"
params: params:
module: ["http_2xx"] module: ["http_2xx"]
static_configs: static_configs:
- targets: - targets:
[ [
${domainsString} ${domainsString}
] ]
relabel_configs: relabel_configs:
- source_labels: ["__address__"] - source_labels: ["__address__"]
target_label: "__param_target" target_label: "__param_target"
replacement: "$$1" regex: '(.*)'
- source_labels: ["__param_target"] replacement: "$1"
target_label: "instance" - source_labels: ["__param_target"]
target_label: "instance"
- target_label: "__address__"
replacement: "127.0.0.1:9115"
- source_labels: ["__address__"]
regex: "127\\.0\\.0\\.1:9115"
target_label: "__scheme__"
replacement: "http"
'' ''
]; ];
}; };

View File

@@ -20,7 +20,7 @@ let
datasourceUid = "vm-datasource-uid"; datasourceUid = "vm-datasource-uid";
model = { model = {
editorMode = "code"; editorMode = "code";
expr = "probe_success{target=\"" + target + "\"} OR on() vector(0)"; expr = "probe_success{instance=\"" + target + "\"} OR on() vector(0)";
hide = false; hide = false;
intervalMs = 1000; intervalMs = 1000;
legendFormat = target; legendFormat = target;
@@ -43,7 +43,7 @@ let
datasourceUid = "__expr__"; datasourceUid = "__expr__";
model = { model = {
type = "math"; type = "math";
expression = "$B < 1"; expression = "$B == 0";
}; };
} }
]; ];

View File

@@ -37,8 +37,7 @@ let
- source_labels: [name] - source_labels: [name]
regex: '(container@git|microvm@git-runner-|postfix|dovecot|openldap|wireguard-wg_cloonar).*\.service' regex: '(container@git|microvm@git-runner-|postfix|dovecot|openldap|wireguard-wg_cloonar).*\.service'
action: keep action: keep
${concatStringsSep "\n" config.services.victoriametrics.extraScrapeConfigs}
${concatStringsSep "\n" config.services.victoriametrics.extraScrapeConfigs}
''; '';
in { in {
options.services.victoriametrics = { options.services.victoriametrics = {