Skip to content

Commit dda2067

Browse files
prometheus: add labels to allow grouping by domain
1 parent 04ec149 commit dda2067

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/prometheus.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ in
176176
genHttpProbeScrapeConfig = { name, opts }: commonProbeScrapeConfig // {
177177
job_name = "blackbox_http_${name}";
178178
params.module = [ "http_${name}" ];
179+
relabel_configs = commonProbeScrapeConfig.relabel_configs ++ [ {
180+
source_labels = [ "__param_target" ];
181+
regex = "https?://(.*)";
182+
target_label = "domain";
183+
} ];
179184
static_configs = [ {
180185
targets = opts.urls;
181186
} ];
@@ -186,6 +191,7 @@ in
186191
job_name = "blackbox_dns_${probe.name}_${domain}";
187192
params.module = [ "dns_${probe.name}_${domain}" ];
188193
static_configs = [ {
194+
labels = { inherit domain; };
189195
inherit (probe.value) targets;
190196
} ];
191197
})

0 commit comments

Comments
 (0)