From 271e43040c2afd50b86e7eccbbf9450b26410000 Mon Sep 17 00:00:00 2001 From: prescientmoon Date: Sat, 24 Feb 2024 10:21:11 +0100 Subject: [PATCH] Set up prometheus nginx exporter --- hosts/nixos/common/optional/services/nginx.nix | 1 + hosts/nixos/lapetus/services/prometheus.nix | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hosts/nixos/common/optional/services/nginx.nix b/hosts/nixos/common/optional/services/nginx.nix index 8eddfaa..78fa5ec 100644 --- a/hosts/nixos/common/optional/services/nginx.nix +++ b/hosts/nixos/common/optional/services/nginx.nix @@ -6,5 +6,6 @@ recommendedOptimisation = true; recommendedProxySettings = true; recommendedTlsSettings = true; + statusPage = true; # Necessary for prometheus exporter }; } diff --git a/hosts/nixos/lapetus/services/prometheus.nix b/hosts/nixos/lapetus/services/prometheus.nix index f284089..b4b775a 100644 --- a/hosts/nixos/lapetus/services/prometheus.nix +++ b/hosts/nixos/lapetus/services/prometheus.nix @@ -10,19 +10,28 @@ in port = 8410; webExternalUrl = "https://${host}"; - # {{{ Node exporter (system info) + # {{{ Base exporters exporters = { + # System info node = { enable = true; enabledCollectors = [ "systemd" ]; port = 8411; }; + + nginx = { + enable = true; + port = 8412; + }; }; scrapeConfigs = [{ job_name = "lapetus"; static_configs = [{ - targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; + targets = [ + "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" + "127.0.0.1:${toString config.services.prometheus.exporters.nginx.port}" + ]; }]; }]; # }}}