Prometheus (#14)

This commit is contained in:
Patrick Stevens
2023-07-21 23:14:12 +01:00
committed by GitHub
parent 8218d37a15
commit 65446c5a25
11 changed files with 146 additions and 14 deletions

View File

@@ -0,0 +1,46 @@
{
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}"];
}
];
}
];
};
};
}