From 0cd40f0f475bdc77f296c417f8c90540b5c25153 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 16 May 2022 00:10:58 +0200 Subject: [PATCH] VEGAS/ipfs: expose metrics --- hosts/VEGAS/services/ipfs/default.nix | 11 ++++++++++- hosts/VEGAS/services/monitoring/default.nix | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/hosts/VEGAS/services/ipfs/default.nix b/hosts/VEGAS/services/ipfs/default.nix index 62aef9c..0ceb2f6 100644 --- a/hosts/VEGAS/services/ipfs/default.nix +++ b/hosts/VEGAS/services/ipfs/default.nix @@ -1,4 +1,4 @@ -{ aspect, config, lib, pkgs, tools, ... }: +{ aspect, config, hosts, lib, pkgs, tools, ... }: with tools.nginx; let inherit (tools.meta) domain; @@ -56,6 +56,15 @@ in locations."/api".proxyPass = "http://unix:/run/ipfs/ipfs-api.sock:"; locations."/ipns/webui.ipfs.${domain}".proxyPass = "http://127.0.0.1:${gwPort}/ipns/webui.ipfs.${domain}"; locations."= /".return = "302 /ipns/webui.ipfs.${domain}"; + locations."/debug/metrics/prometheus" = { + proxyPass = "http://unix:/run/ipfs/ipfs-api.sock:"; + extraConfig = '' + access_log off; + auth_request off; + allow ${hosts.VEGAS.interfaces.primary.addr}; + deny all; + ''; + }; }; }; services.oauth2_proxy.nginx.virtualHosts = [ "ipfs.admin.${domain}" ]; diff --git a/hosts/VEGAS/services/monitoring/default.nix b/hosts/VEGAS/services/monitoring/default.nix index 0636103..dedea69 100644 --- a/hosts/VEGAS/services/monitoring/default.nix +++ b/hosts/VEGAS/services/monitoring/default.nix @@ -106,6 +106,17 @@ in } ]; } + { + job_name = "ipfs"; + scheme = "https"; + metrics_path = "/debug/metrics/prometheus"; + static_configs = [ + { + targets = [ "ipfs.admin.${domain}" ]; + labels.instance = "VEGAS"; + } + ]; + } ]; };