1
0

hosts/monitoring-3: use primary fqdn for instance label in prometheus

This commit is contained in:
clerie 2023-01-05 22:02:48 +01:00
parent 1dfba9663a
commit 30e22dff8d

View File

@ -131,7 +131,14 @@ in {
services.prometheus = {
enable = true;
listenAddress = "[::1]";
scrapeConfigs = [
scrapeConfigs = let
relabelAddressToInstance = {
source_labels = [ "__address__" ];
target_label = "instance";
regex = ''([\w-]+)\.mon\.clerie\.de\:\d+'';
replacement = "\${1}.net.clerie.de";
};
in [
{
job_name = "prometheus";
scrape_interval = "20s";
@ -143,6 +150,9 @@ in {
];
}
];
relabel_configs = [
relabelAddressToInstance
];
}
{
job_name = "node-exporter";
@ -155,6 +165,9 @@ in {
++ monitoringTargets;
}
];
relabel_configs = [
relabelAddressToInstance
];
}
{
job_name = "nixos-exporter";
@ -164,6 +177,9 @@ in {
targets = nixosMonitoringTargets;
}
];
relabel_configs = [
relabelAddressToInstance
];
}
{
job_name = "bird-exporter";
@ -173,6 +189,9 @@ in {
targets = birdMonitoringTargets;
}
];
relabel_configs = [
relabelAddressToInstance
];
}
{
job_name = "blackbox_icmp6";
@ -211,10 +230,7 @@ in {
target_label = "__address__";
replacement = "\${1}";
}
{
source_labels = [ "__address__" ];
target_label = "instance";
}
relabelAddressToInstance
];
}
{
@ -255,10 +271,7 @@ in {
target_label = "__address__";
replacement = "\${1}";
}
{
source_labels = [ "__address__" ];
target_label = "instance";
}
relabelAddressToInstance
];
}
{
@ -297,6 +310,9 @@ in {
];
}
];
relabel_configs = [
relabelAddressToInstance
];
}
];
alertmanagers = [