nixos-config/machines/chungus/telemetry/prometheus.nix

37 lines
868 B
Nix
Raw Permalink Normal View History

2023-04-29 23:29:05 +02:00
{ config, pkgs, lib, ... }: {
services.nginx = {
enable = true;
statusPage = true;
virtualHosts = {
2023-05-13 00:29:13 +02:00
"prometheus.${config.networking.hostName}.private" = {
2023-04-29 23:29:05 +02:00
extraConfig = ''
allow ${config.tinc.private.subnet};
deny all;
'';
locations."/" = { proxyPass = "http://localhost:${toString config.services.prometheus.port}"; };
};
};
};
services.prometheus = {
checkConfig = "syntax-only";
enable = true;
# keep data for 30 days
2023-07-29 09:29:38 +02:00
extraFlags = [ "--storage.tsdb.retention.time=90d" ];
2023-04-29 23:29:05 +02:00
};
2024-05-16 09:49:22 +02:00
services.grafana.provision.datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Prometheus";
type = "prometheus";
uid = "prometheus01";
url = "http://localhost:${toString config.services.prometheus.port}";
}
];
};
2023-04-29 23:29:05 +02:00
}