1
Fork 0
satellite/hosts/nixos/lapetus/services/prometheus.nix

46 lines
1.1 KiB
Nix
Raw Normal View History

2024-02-24 06:52:01 +01:00
{ config, pkgs, ... }:
{
# {{{ Main config
services.prometheus = {
enable = true;
2024-06-13 15:47:36 +02:00
port = config.satellite.ports.prometheus;
webExternalUrl = config.satellite.nginx.at.prometheus.url;
2024-02-24 06:52:01 +01:00
2024-02-24 10:21:11 +01:00
# {{{ Base exporters
2024-02-24 06:52:01 +01:00
exporters = {
2024-02-24 10:21:11 +01:00
# System info
2024-02-24 06:52:01 +01:00
node = {
enable = true;
enabledCollectors = [ "systemd" ];
2024-06-13 15:47:36 +02:00
port = config.satellite.ports.prometheus-node-exporter;
2024-02-24 06:52:01 +01:00
};
2024-02-24 10:21:11 +01:00
nginx = {
enable = true;
2024-06-13 15:47:36 +02:00
port = config.satellite.ports.prometheus-nginx-exporter;
2024-02-24 10:21:11 +01:00
};
2024-02-24 06:52:01 +01:00
};
scrapeConfigs = [{
job_name = "lapetus";
static_configs = [{
2024-02-24 10:21:11 +01:00
targets = [
"127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
"127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}"
];
2024-02-24 06:52:01 +01:00
}];
}];
# }}}
};
# }}}
# {{{ Networking & storage
2024-06-13 15:47:36 +02:00
satellite.nginx.at.prometheus.port = config.services.prometheus.port;
2024-02-24 06:52:01 +01:00
environment.persistence."/persist/state".directories = [{
directory = "/var/lib/prometheus2";
user = "prometheus";
group = "prometheus";
}];
2024-02-24 06:52:01 +01:00
# }}}
}