dotfiles.nix/nixos/viridian/services/prometheus/default.nix

33 lines
818 B
Nix
Raw Normal View History

2024-08-08 09:02:42 +08:00
{config, ...}: {
2024-06-06 20:43:43 +08:00
services.prometheus = {
enable = true;
2024-08-08 09:02:42 +08:00
port = 9001; # Port to listen on.
2024-06-06 20:43:43 +08:00
# Valid in all configuration contexts, defaults for other configuration sections.
globalConfig = {
scrape_interval = "15s";
};
# Collect specific metrics, format them, and expose them through HTTP endpoints for prometheus to scrape.
exporters = {
node = {
enable = true;
2024-08-08 09:02:42 +08:00
enabledCollectors = ["systemd" "processes"];
2024-06-06 20:43:43 +08:00
port = 9100;
};
};
# Specify a set of targets and parameters describing how to scrape them.
scrapeConfigs = [
{
job_name = "node";
2024-08-08 09:02:42 +08:00
static_configs = [
{
targets = ["127.0.0.1:${toString config.services.prometheus.exporters.node.port}"];
}
];
2024-06-06 20:43:43 +08:00
}
];
};
}