inputs: { config, ... }: { imports = [ (import ./monitoring-target.nix inputs) ]; services.prometheus = { enable = true; listenAddress = "127.0.0.1"; # TODO: for NixOS 21.05 extraFlags = [ "--storage.tsdb.retention=15w" ]; #retentionTime = "15w"; scrapeConfigs = [ { job_name = "prometheus"; static_configs = [ { targets = [ "localhost:${toString config.services.prometheus.port}" ]; } ]; } { job_name = "node_exporter"; static_configs = [ { targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; } ]; } { job_name = "grafana"; static_configs = [ { targets = [ "localhost:${toString config.services.grafana.port}" ]; } ]; } ]; }; services.grafana = { enable = true; addr = config.topology.mainVpn.currentNodeIP; port = 3001; analytics.reporting.enable = false; }; networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [ config.services.grafana.port ]; }