feat: add prometheus config
This commit is contained in:
parent
3f517bbe7f
commit
d9b7ebf95c
3 changed files with 43 additions and 0 deletions
24
services/prometheus.nix
Normal file
24
services/prometheus.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{lib, ...}:
|
||||
let
|
||||
serv = import ../config/services.nix;
|
||||
conf = lib.attrsets.mapAttrsToList (name: cfg: {
|
||||
job_name = name;
|
||||
|
||||
scrape_interval = cfg.scrape_interval;
|
||||
|
||||
metrics_path = cfg.metrics_path;
|
||||
|
||||
static_configs = cfg.static_configs;
|
||||
}) serv.prometheus.scrapeConfigs;
|
||||
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