diff --git a/morph/grid/local/grid.nix b/morph/grid/local/grid.nix index 55b7587c5bbfb6169b8cc1fda506a8d6c07d4dcd..bca902f20440e60e7d71162f273dd65d67317545 100644 --- a/morph/grid/local/grid.nix +++ b/morph/grid/local/grid.nix @@ -49,7 +49,7 @@ let gridlib.monitoring (gridlib.hardware-virtual ({ publicIPv4 = "192.168.67.24"; })) (gridlib.customize-monitoring { - inherit hostsMap vpnClientIPs nodeExporterTargets; + inherit hostsMap vpnClientIPs nodeExporterTargets paymentExporterTargets; inherit (config) domain publicKeyPath privateKeyPath; monitoringvpnIPv4 = "172.23.23.1"; stateVersion = "19.09"; @@ -66,6 +66,7 @@ let }; vpnClientIPs = [ "172.23.23.11" "172.23.23.12" "172.23.23.13" ]; nodeExporterTargets = [ "monitoring" "payments" "storage1" "storage2" ]; + paymentExporterTargets = [ "payments" ]; in { network = { diff --git a/morph/grid/production/grid.nix b/morph/grid/production/grid.nix index fb680338a08b0006e166b13066199d20f6836e44..1aa605615dc26c9394f4f7143f5f50975107cffe 100644 --- a/morph/grid/production/grid.nix +++ b/morph/grid/production/grid.nix @@ -28,7 +28,7 @@ let gridlib.monitoring gridlib.hardware-aws (gridlib.customize-monitoring { - inherit hostsMap vpnClientIPs nodeExporterTargets; + inherit hostsMap vpnClientIPs nodeExporterTargets paymentExporterTargets; inherit (config) domain publicKeyPath privateKeyPath; monitoringvpnIPv4 = "172.23.23.1"; stateVersion = "19.09"; @@ -103,6 +103,7 @@ let "storage004" "storage005" ]; + paymentExporterTargets = [ "payments" ]; in { network = { diff --git a/morph/grid/testing/grid.nix b/morph/grid/testing/grid.nix index 0cdfe5ae755c88baa128eddbafb14f1b19d6edbf..996b1fba0bd2c12c22b00f549aa26c8b8472653d 100644 --- a/morph/grid/testing/grid.nix +++ b/morph/grid/testing/grid.nix @@ -39,7 +39,7 @@ let gridlib.monitoring gridlib.hardware-aws (gridlib.customize-monitoring { - inherit hostsMap vpnClientIPs nodeExporterTargets; + inherit hostsMap vpnClientIPs nodeExporterTargets paymentExporterTargets; inherit (config) domain publicKeyPath privateKeyPath; monitoringvpnIPv4 = "172.23.23.1"; stateVersion = "19.09"; @@ -55,6 +55,7 @@ let }; vpnClientIPs = [ "172.23.23.11" "172.23.23.12" ]; nodeExporterTargets = [ "monitoring" "payments" "storage001" ]; + paymentExporterTargets = [ "payments" ]; in { network = { diff --git a/morph/lib/customize-monitoring.nix b/morph/lib/customize-monitoring.nix index f77d26bd817ebb556c1d22d01e290d2838ab9485..05fe45107e44c583c495ee55aeb9e351ba3871f1 100644 --- a/morph/lib/customize-monitoring.nix +++ b/morph/lib/customize-monitoring.nix @@ -26,6 +26,10 @@ # which nodes to scrape "nginxExporter" metrics from. , nginxExporterTargets ? [] + # A list of VPN clients (IP addresses or hostnames) as strings indicating + # which nodes to scrape PaymentServer metrics from. +, paymentExporterTargets ? [] + # A string giving the NixOS state version for the system. , stateVersion , ... @@ -52,6 +56,7 @@ services.private-storage.monitoring.prometheus = { inherit nodeExporterTargets; inherit nginxExporterTargets; + inherit paymentExporterTargets; }; system.stateVersion = stateVersion; diff --git a/nixos/modules/monitoring/server/prometheus.nix b/nixos/modules/monitoring/server/prometheus.nix index 36c2ba6402559771dff8771b1369842e21f7ff7f..c92261ccad2ebdd8dd34dda9027e66962b345be9 100644 --- a/nixos/modules/monitoring/server/prometheus.nix +++ b/nixos/modules/monitoring/server/prometheus.nix @@ -26,6 +26,11 @@ in { example = lib.literalExample "[ node1 node2 ]"; description = "List of nodes (hostnames or IPs) to scrape."; }; + paymentExporterTargets = lib.mkOption { + type = with lib.types; listOf str; + example = lib.literalExample "[ node1 node2 ]"; + description = "List of nodes (hostnames or IPs) to scrape."; + }; }; config = rec { @@ -49,6 +54,15 @@ in { }]; relabel_configs = [ dropPortNumber ]; } + { + job_name = "payment-exporters"; + scheme = "https"; + tls_config.insecure_skip_verify = true; + static_configs = [{ + targets = cfg.paymentExporterTargets; + }]; + relabel_configs = [ dropPortNumber ]; + } ]; }; };