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

45 lines
894 B
Nix
Raw Permalink Normal View History

2024-08-29 03:26:04 +02:00
{
config,
pkgs,
lib,
...
}:
{
2023-04-29 23:29:05 +02:00
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;
'';
2024-08-29 03:26:04 +02:00
locations."/" = {
proxyPass = "http://localhost:${toString config.services.prometheus.port}";
};
2023-04-29 23:29:05 +02:00
};
};
};
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
}