grimm-nixos-laptop/modules/prometheus.nix

48 lines
1.1 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
2024-09-28 22:09:24 +02:00
inherit (lib)
filter
isAttrs
attrValues
filterAttrs
;
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}") (
2024-09-28 22:09:24 +02:00
filter (v: (isAttrs v) && v.enable) (
attrValues (filterAttrs (n: v: n != "minio") config.services.prometheus.exporters)
)
);
2024-05-08 21:50:08 +02:00
}
];
2024-05-08 21:49:37 +02:00
}
];
exporters = {
2024-09-28 22:09:24 +02:00
# nginx.enable = true;
2024-05-08 21:49:37 +02:00
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
};
};
};
}