Files
PulumiConfig/PulumiWebServer/Nix/prometheus/prometheus.nix
Patrick Stevens 65446c5a25 Prometheus (#14)
2023-07-21 23:14:12 +01:00

47 lines
1003 B
Nix

{
config,
pkgs,
lib,
...
}: {
options = {
services.prometheus-config = {
port = lib.mkOption {
type = lib.types.port;
description = lib.mdDoc "Prometheus localhost port";
default = 9002;
};
node-exporter-port = lib.mkOption {
type = lib.types.port;
description = lib.mdDoc "Localhost port for node exporter";
default = 9003;
};
};
};
config = {
services.prometheus = {
enable = true;
port = config.services.prometheus-config.port;
exporters = {
node = {
enable = true;
enabledCollectors = ["systemd"];
port = config.services.prometheus-config.node-exporter-port;
};
};
scrapeConfigs = [
{
job_name = "node";
static_configs = [
{
targets = ["localhost:${toString config.services.prometheus.exporters.node.port}"];
}
];
}
];
};
};
}