renge/prometheus: Use common relabel config for VPN
This commit is contained in:
parent
5245fa82d4
commit
69c4138459
|
@ -8,6 +8,12 @@ let
|
|||
|
||||
mkStaticTargets = targets: lib.singleton { inherit targets; };
|
||||
mkStaticTarget = target: mkStaticTargets (lib.singleton target);
|
||||
|
||||
relabelVpnConfig = {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:[0-9]*";
|
||||
};
|
||||
in
|
||||
{
|
||||
services.prometheus = {
|
||||
|
@ -77,11 +83,7 @@ in
|
|||
"yuzuru.vpn.sbruder.de:9100"
|
||||
"koyomi.vpn.sbruder.de:9100"
|
||||
];
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:9100";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
{
|
||||
job_name = "smartctl";
|
||||
|
@ -93,11 +95,7 @@ in
|
|||
"shinobu.vpn.sbruder.de:9633"
|
||||
"koyomi.vpn.sbruder.de:9633"
|
||||
];
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:9633";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
{
|
||||
job_name = "qbittorrent";
|
||||
|
@ -105,11 +103,7 @@ in
|
|||
"fuuko.vpn.sbruder.de:9561"
|
||||
"nazuna.vpn.sbruder.de:9561"
|
||||
];
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:9561";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
(
|
||||
let
|
||||
|
@ -128,10 +122,7 @@ in
|
|||
{
|
||||
job_name = "dnsmasq";
|
||||
static_configs = mkStaticTarget "shinobu.vpn.sbruder.de:${toString config.services.prometheus.exporters.dnsmasq.port}";
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
replacement = "shinobu";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
{
|
||||
job_name = "hcloud";
|
||||
|
@ -158,11 +149,7 @@ in
|
|||
"okarin.vpn.sbruder.de:9433"
|
||||
"yuzuru.vpn.sbruder.de:9433"
|
||||
];
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:9433";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
{
|
||||
job_name = "snmp";
|
||||
|
@ -193,11 +180,7 @@ in
|
|||
static_configs = mkStaticTargets [
|
||||
"koyomi.vpn.sbruder.de:8404"
|
||||
];
|
||||
relabel_configs = lib.singleton {
|
||||
target_label = "instance";
|
||||
source_labels = lib.singleton "__address__";
|
||||
regex = "(.*)\\.vpn\\.sbruder\\.de:8404";
|
||||
};
|
||||
relabel_configs = lib.singleton relabelVpnConfig;
|
||||
}
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in a new issue