nixos-config/machines/chungus/telemetry/prometheus.nix
2025-02-26 14:57:23 +07:00

40 lines
819 B
Nix

{
config,
pkgs,
lib,
...
}:
{
services.nginx = {
enable = true;
statusPage = true;
virtualHosts = {
"prometheus.${config.networking.hostName}.private" = {
extraConfig = ''
allow ${config.tinc.private.subnet};
deny all;
'';
locations."/" = {
proxyPass = "http://localhost:${toString config.services.prometheus.port}";
};
};
};
};
telemetry.apps.prometheus.enable = true;
telemetry.apps.prometheus.retentionTime = "90d";
services.grafana.provision.datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Prometheus";
type = "prometheus";
uid = "prometheus01";
url = "http://localhost:${toString config.services.prometheus.port}";
}
];
};
}