feat: add prometheus config
This commit is contained in:
parent
3f517bbe7f
commit
dc80375884
3 changed files with 37 additions and 0 deletions
|
|
@ -11,4 +11,20 @@ rec {
|
||||||
"processes"
|
"processes"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
prometheus = {
|
||||||
|
port = 9090;
|
||||||
|
scrapeConfigs = {
|
||||||
|
node = {
|
||||||
|
static_configs = [
|
||||||
|
{
|
||||||
|
targets = [
|
||||||
|
"localhost:9100"
|
||||||
|
"pi.home:9100"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@
|
||||||
./openssh.nix
|
./openssh.nix
|
||||||
./forgejo.nix
|
./forgejo.nix
|
||||||
./node-exporter.nix
|
./node-exporter.nix
|
||||||
|
./prometheus.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
services/prometheus.nix
Normal file
20
services/prometheus.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{lib, ...}:
|
||||||
|
let
|
||||||
|
serv = import ../config/services.nix;
|
||||||
|
conf = lib.attrsets.mapAttrsToList (name: cfg: {
|
||||||
|
job_name = name;
|
||||||
|
|
||||||
|
static_configs = cfg.static_configs;
|
||||||
|
}) serv.prometheus.scrape_configs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.prometheus = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
scrapeConfigs = conf;
|
||||||
|
|
||||||
|
port = serv.prometheus.port;
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ serv.prometheus.port ];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue