grimm-nixos-laptop/modules/prometheus.nix

41 lines
973 B
Nix
Raw Normal View History

{ config, lib, ... }:
2024-05-08 21:49:37 +02:00
let
inherit (config.serverConfig) ports vhosts;
2024-05-08 21:50:08 +02:00
in
{
2024-05-08 21:49:37 +02:00
services.prometheus = {
enable = true;
port = vhosts.prometheus_host.port;
2024-05-08 21:49:37 +02:00
globalConfig.scrape_interval = "15s";
scrapeConfigs = [
{
job_name = "chrysalis";
2024-05-08 21:50:08 +02:00
static_configs = [
{
targets =
2024-05-11 22:55:59 +02:00
let
2024-05-25 21:50:51 +02:00
inherit (lib) filter isAttrs attrValues;
2024-05-11 22:55:59 +02:00
in
2024-05-12 10:39:52 +02:00
map (v: "127.0.0.1:${builtins.toString v.port}") (
filter (v: (isAttrs v) && v.enable) (attrValues config.services.prometheus.exporters)
);
2024-05-08 21:50:08 +02:00
}
];
2024-05-08 21:49:37 +02:00
}
];
exporters = {
nginx.enable = true;
redis.enable = true;
domain.enable = true;
postgres.enable = true;
nginxlog.enable = true;
jitsi.enable = true;
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = ports.node_exporter.port;
2024-05-08 21:49:37 +02:00
};
};
};
}