pvv-nixos-config/hosts/ildkule/services/metrics/prometheus.nix

69 lines
1.7 KiB
Nix
Raw Normal View History

2022-12-19 22:56:42 +01:00
{ config, pkgs, ... }:
2022-12-20 21:44:22 +01:00
let
cfg = config.services.prometheus;
in {
2022-12-19 22:56:42 +01:00
services.prometheus = {
enable = true;
2022-12-20 00:26:29 +01:00
listenAddress = "127.0.0.1";
2022-12-19 22:56:42 +01:00
port = 9001;
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = [
2022-12-20 21:44:22 +01:00
"ildkule.pvv.ntnu.no:${toString cfg.exporters.node.port}"
2022-12-19 22:56:42 +01:00
"microbel.pvv.ntnu.no:9100"
2023-01-14 22:44:55 +01:00
"isvegg.pvv.ntnu.no:9100"
2022-12-19 22:56:42 +01:00
"knakelibrak.pvv.ntnu.no:9100"
2023-01-17 13:47:48 +01:00
"hildring.pvv.ntnu.no:9100"
"bicep.pvv.ntnu.no:9100"
2023-01-17 10:32:10 +01:00
"jokum.pvv.ntnu.no:9100"
2022-12-19 22:56:42 +01:00
];
}
];
}
2022-12-20 23:10:00 +01:00
{
job_name = "synapse";
scrape_interval = "15s";
scheme = "https";
http_sd_configs = [
{
url = "https://matrix.pvv.ntnu.no/metrics/config.json";
}
];
relabel_configs = [
{
source_labels = [ "__address__" ];
regex = "[^/]+(/.*)";
target_label = "__metrics_path__";
}
{
source_labels = [ "__address__" ];
regex = "([^/]+)/.*";
target_label = "instance";
}
{
source_labels = [ "__address__" ];
regex = "[^/]+\\/+[^/]+/(.*)/\\d+$";
target_label = "job";
}
{
source_labels = [ "__address__" ];
regex = "[^/]+\\/+[^/]+/.*/(\\d+)$";
target_label = "index";
}
{
source_labels = [ "__address__" ];
regex = "([^/]+)/.*";
target_label = "__address__";
}
];
2022-12-20 23:10:00 +01:00
}
2022-12-19 22:56:42 +01:00
];
2022-12-20 23:10:00 +01:00
ruleFiles = [ rules/synapse-v2.rules ];
2022-12-19 22:56:42 +01:00
};
}