36 lines
751 B
Nix
36 lines
751 B
Nix
{config, ...}: let
|
|
inherit (config.services) prometheus;
|
|
nodes = [
|
|
"100.65.29.110"
|
|
"100.106.241.122"
|
|
];
|
|
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;
|
|
};
|
|
};
|
|
};
|
|
}
|