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 =
[
{
job_name = "ping";
static_configs = [
(
let
port = toString config.services.prometheus.exporters.ping.port;
hosts = [
"fwminex.servers.jakst"
"fra1-b.servers.jakst"
"vno1-gdrx.motiejus.jakst"
];
in
{
targets = [
"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 = "ping";
relabel_configs = map (hostname: {
source_labels = [ "__address__" ];
regex = "${myData.hosts.${hostname}.jakstIP}:${port}";
replacement = "${hostname}:${port}";
target_label = "__address__";
}) hosts;
static_configs = [
{
targets = [ "127.0.0.1:${port}" ] ++ map (host: "${myData.hosts.${host}.jakstIP}:${port}") hosts;
}
];
}
)
];
}
{
job_name = "prometheus";
static_configs = [ { targets = [ "127.0.0.1:${toString myData.ports.prometheus}" ]; } ];