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

52 lines
1.1 KiB
Nix
Raw Normal View History

2024-02-24 06:52:01 +01:00
{ config, pkgs, ... }:
let host = "prometheus.moonythm.dev";
in
{
imports = [ ../../common/optional/services/nginx.nix ];
# {{{ Main config
services.prometheus = {
enable = true;
port = 8410;
webExternalUrl = "https://${host}";
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" ];
port = 8411;
};
2024-02-24 10:21:11 +01:00
nginx = {
enable = true;
port = 8412;
};
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
services.nginx.virtualHosts.${host} =
2024-02-24 14:24:35 +01:00
config.satellite.proxy config.services.prometheus.port
{ proxyWebsockets = true; };
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
# }}}
}