From 0205e3d2ba40a30f483d414e27b54a8d740bfbbd Mon Sep 17 00:00:00 2001 From: Florian Sesser <florian@private.storage> Date: Sat, 3 Sep 2022 08:28:03 +0000 Subject: [PATCH] Monitoring: Add Loki to Prometheus-monitored services ... missing: actually set it up - this is just the nix configuration scaffolding --- morph/lib/monitoring.nix | 1 + nixos/modules/monitoring/server/prometheus.nix | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/morph/lib/monitoring.nix b/morph/lib/monitoring.nix index 7107e5b7..30d6437f 100644 --- a/morph/lib/monitoring.nix +++ b/morph/lib/monitoring.nix @@ -152,6 +152,7 @@ in { inherit nodeExporterTargets; inherit (cfg) paymentExporterTargets blackboxExporterHttpsTargets; nginxExporterTargets = []; + lokiExporterTargets = []; }; services.private-storage.monitoring.grafana = { diff --git a/nixos/modules/monitoring/server/prometheus.nix b/nixos/modules/monitoring/server/prometheus.nix index 2a78dd3e..52a57fd9 100644 --- a/nixos/modules/monitoring/server/prometheus.nix +++ b/nixos/modules/monitoring/server/prometheus.nix @@ -26,6 +26,11 @@ in { example = [ "node1" "node2" ]; description = "List of nodes (hostnames or IPs) to scrape."; }; + lokiExporterTargets = lib.mkOption { + type = with lib.types; listOf str; + example = [ "node1" "node2" ]; + description = "List of nodes (hostnames or IPs) to scrape."; + }; paymentExporterTargets = lib.mkOption { type = with lib.types; listOf str; example = [ "node1" "node2" ]; @@ -59,6 +64,13 @@ in { }]; relabel_configs = [ dropPortNumber ]; } + { + job_name = "loki-exporters"; + static_configs = [{ + targets = map (x: x + ":" + (toString exportersCfg.loki.port)) cfg.lokiExporterTargets; + }]; + relabel_configs = [ dropPortNumber ]; + } { job_name = "payment-exporters"; scheme = "https"; -- GitLab