From 5a355b163a7db457d5258c91fa1ee30a48d7f262 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Mon, 4 Mar 2024 20:52:33 +0500 Subject: [PATCH] feat: synapse monitoring --- nixos/programs/prometheus.nix | 7 +++++++ nixos/programs/synapse.nix | 35 ++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/nixos/programs/prometheus.nix b/nixos/programs/prometheus.nix index 0d575a5..15fbfb7 100644 --- a/nixos/programs/prometheus.nix +++ b/nixos/programs/prometheus.nix @@ -18,6 +18,13 @@ targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}" ]; }]; } + { + job_name = "synapse"; + metrics_path = "/_synapse/metrics"; + static_configs = [{ + targets = [ "127.0.0.1:55013" ]; + }]; + } ]; }; } diff --git a/nixos/programs/synapse.nix b/nixos/programs/synapse.nix index c95bd0f..8dd0f02 100644 --- a/nixos/programs/synapse.nix +++ b/nixos/programs/synapse.nix @@ -21,19 +21,32 @@ in { database = "matrix-synapse"; }; }; + enable_metrics = true; enable_registration = true; report_stats = true; - listeners = [{ - bind_addresses = [ "127.0.0.1" ]; - port = 8008; - type = "http"; - tls = false; - x_forwarded = true; - resources = [{ - names = [ "client" "federation" ]; - compress = false; - }]; - }]; + listeners = [ + { + bind_addresses = [ "127.0.0.1" ]; + port = 8008; + type = "http"; + tls = false; + x_forwarded = true; + resources = [{ + names = [ "client" "federation" ]; + compress = false; + }]; + } + { + bind_addresses = [ "127.0.0.1" ]; + port = 55013; + type = "metrics"; + tls = false; + resources = [{ + names = [ "metrics" ]; + compress = false; + }]; + } + ]; signing_key_path = "/var/lib/matrix-synapse/matrix.comfycamp.space.signing.key"; }; extraConfigFiles = [