grimm-nixos-laptop/modules/prometheus.nix

46 lines
1.0 KiB
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
inherit (lib)
toString
filter
isAttrs
attrValues
;
in
map (v: "127.0.0.1:${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
};
};
};
}