From b6f712b8174c0e23b813ce64f711fa5a88607649 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 13 Jul 2021 15:58:43 +0200 Subject: [PATCH] services: nginx: enable prometheus exporter --- services/nginx.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/services/nginx.nix b/services/nginx.nix index 134615e..cfb7da1 100644 --- a/services/nginx.nix +++ b/services/nginx.nix @@ -18,6 +18,25 @@ networking.firewall.allowedTCPPorts = [ 80 443 ]; + services.prometheus = { + exporters.nginx = { + enable = true; + listenAddress = "127.0.0.1"; + }; + + scrapeConfigs = [ + { + job_name = "nginx"; + static_configs = [{ + targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" ]; + labels = { + instance = config.networking.hostName; + }; + }]; + } + ]; + }; + security.acme = { acceptTerms = true; email = "antoine97.martin@gmail.com";