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

77 lines
1.8 KiB
Nix
Raw Permalink 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-15 00:19:41 +01:00
{
job_name = "exim";
scrape_interval = "60s";
static_configs = [
{
targets = [
"microbel.pvv.ntnu.no:9636"
];
}
];
}
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-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
};
}