mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-06-15 09:09:14 +02:00
{ildkule/prometheus,base}: send stats over HTTPS through nginx
This commit is contained in:
@@ -5,19 +5,30 @@ in
|
||||
{
|
||||
services.prometheus.exporters.node = {
|
||||
enable = lib.mkDefault true;
|
||||
listenAddress = "127.0.0.1";
|
||||
port = 9100;
|
||||
enabledCollectors = [ "systemd" ];
|
||||
};
|
||||
|
||||
systemd.services.prometheus-node-exporter.serviceConfig = lib.mkIf cfg.enable {
|
||||
IPAddressDeny = "any";
|
||||
IPAddressAllow = [
|
||||
"127.0.0.1"
|
||||
"::1"
|
||||
values.hosts.ildkule.ipv4
|
||||
values.hosts.ildkule.ipv6
|
||||
];
|
||||
};
|
||||
services.nginx = {
|
||||
enable = lib.mkDefault true;
|
||||
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.enable [ cfg.port ];
|
||||
virtualHosts.${config.networking.fqdn} = lib.mkIf config.services.nginx.enable {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
kTLS = true;
|
||||
|
||||
locations."/prometheus-node-exporter/metrics" = {
|
||||
proxyPass = "http://localhost:${toString cfg.port}/metrics";
|
||||
|
||||
extraConfig = ''
|
||||
allow 127.0.0.1;
|
||||
allow ::1;
|
||||
allow ${values.hosts.ildkule.ipv4};
|
||||
allow ${values.hosts.ildkule.ipv6};
|
||||
deny all;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user