grimm-nixos-laptop/modules/prometheus.nix

47 lines
1.1 KiB
Nix

{ config, lib, ... }:
let
inherit (config.serverConfig) ports vhosts;
in
{
services.prometheus = {
enable = true;
port = vhosts.prometheus_host.port;
globalConfig.scrape_interval = "15s";
scrapeConfigs = [
{
job_name = "chrysalis";
static_configs = [
{
targets =
let
inherit (lib)
filter
isAttrs
attrValues
filterAttrs
;
in
map (v: "127.0.0.1:${builtins.toString v.port}") (
filter (v: (isAttrs v) && v.enable) (
attrValues (filterAttrs (n: v: n != "minio" && n != "tor") config.services.prometheus.exporters)
)
);
}
];
}
];
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;
};
};
};
}