blob: b06c9f709c47b306a2b12c1499e5a95c5bf73ec3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{ config, lib }:
rec {
mkTarget = host: port: {
targets = [ "${host}:${toString port}" ];
};
mkScrapeConfig = name: hosts: port: {
job_name = name;
static_configs = map (host: mkTarget host port) hosts;
relabel_configs = relabelConfig;
};
mkScrape = name: targets: {
job_name = name;
static_configs = [{
targets = targets;
}];
relabel_configs = relabelConfig;
};
relabelConfig = [{
source_labels = ["__address__"];
target_label = "host";
regex = "([^:]+)(:[0-9]+)?";
replacement = "\${1}";
}];
}
|