ping: relabel

This commit is contained in:
Motiejus Jakštys 2024-09-16 15:10:54 +03:00
parent 77b5094616
commit 550d1c05e1
1 changed files with 23 additions and 16 deletions

View File

@ -344,24 +344,31 @@ in
scrapeConfigs = scrapeConfigs =
[ [
{ (
job_name = "ping"; let
static_configs = [ port = toString config.services.prometheus.exporters.ping.port;
( hosts = [
let "fwminex.servers.jakst"
port = toString config.services.prometheus.exporters.ping.port; "fra1-b.servers.jakst"
in "vno1-gdrx.motiejus.jakst"
];
in
{
job_name = "ping";
relabel_configs = map (hostname: {
source_labels = [ "__address__" ];
regex = "${myData.hosts.${hostname}.jakstIP}:${port}";
replacement = "${hostname}:${port}";
target_label = "__address__";
}) hosts;
static_configs = [
{ {
targets = [ targets = [ "127.0.0.1:${port}" ] ++ map (host: "${myData.hosts.${host}.jakstIP}:${port}") hosts;
"127.0.0.1:${port}"
"${myData.hosts."fwminex.servers.jakst".jakstIP}:${port}"
"${myData.hosts."fra1-b.servers.jakst".jakstIP}:${port}"
"${myData.hosts."vno1-gdrx.motiejus.jakst".jakstIP}:${port}"
];
} }
) ];
]; }
} )
{ {
job_name = "prometheus"; job_name = "prometheus";
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.prometheus}" ]; } ]; static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.prometheus}" ]; } ];