37 lines
760 B
Nix
37 lines
760 B
Nix
{config, ...}: let
|
|
inherit (config.services) prometheus;
|
|
nodes = [
|
|
"alpine"
|
|
"fcs-tristan-nixbook"
|
|
"zenix"
|
|
];
|
|
addPort = ip: "${ip}:${toString prometheus.exporters.node.port}";
|
|
in {
|
|
services.prometheus = {
|
|
enable = true;
|
|
scrapeConfigs = [
|
|
{
|
|
job_name = "nodes";
|
|
static_configs = [
|
|
{
|
|
targets = builtins.map addPort nodes;
|
|
}
|
|
];
|
|
}
|
|
{
|
|
job_name = "prometheus";
|
|
static_configs = [
|
|
{
|
|
targets = ["localhost:${toString config.services.prometheus.exporters.postgres.port}"];
|
|
}
|
|
];
|
|
}
|
|
];
|
|
exporters = {
|
|
postgres = {
|
|
enable = true;
|
|
runAsLocalSuperUser = true;
|
|
};
|
|
};
|
|
};
|
|
}
|