From 52e32157c076a5c2999a49de8b524f50e35c665d Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 29 May 2023 22:10:27 +0200 Subject: prometheus-borg-exporter --- hosts/vidhar/borg/default.nix | 20 ++++++++++++++++++++ hosts/vidhar/prometheus/default.nix | 12 ++++++++++++ 2 files changed, 32 insertions(+) (limited to 'hosts') diff --git a/hosts/vidhar/borg/default.nix b/hosts/vidhar/borg/default.nix index 922cbf02..c97c4216 100644 --- a/hosts/vidhar/borg/default.nix +++ b/hosts/vidhar/borg/default.nix @@ -48,6 +48,10 @@ let baseDir = "/srv/backup/borg"; in { + imports = with flakeInputs; [ + prometheus-borg-exporter.nixosModules.default + ]; + config = { services.borgsnap = { enable = true; @@ -86,6 +90,22 @@ in { }; }; + services.prometheus-borg-exporter = { + enable = true; + gateway = "localhost:9091"; + target = "yggdrasil.borgbase:repo"; + inherit sshConfig; + keyfile = config.sops.secrets."yggdrasil.borgkey".path; + + config = { + job = "yggdrasil.borgbase"; + groups = [ + { regex = "(?Pyggdrasil\.(surtr|vidhar|niflheim\.ymir))\.(?P.+)-[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}"; } + ]; + }; + }; + + # systemd.services."check-borg@${utils.escapeSystemdPath "${baseDir}/jotnar"}" = checkBorgUnit; # systemd.services."check-borg@${utils.escapeSystemdPath "yggdrasil.borgbase:repo"}" = recursiveUpdate checkBorgUnit { # serviceConfig = { diff --git a/hosts/vidhar/prometheus/default.nix b/hosts/vidhar/prometheus/default.nix index 133ddbbc..d6d29c17 100644 --- a/hosts/vidhar/prometheus/default.nix +++ b/hosts/vidhar/prometheus/default.nix @@ -241,6 +241,13 @@ in { ]; scrape_interval = "5s"; } + { job_name = "pushgateway"; + honor_labels = true; + static_configs = [ + { targets = ["localhost:9091"];} + ]; + scrape_interval = "5s"; + } ]; rules = [ @@ -288,7 +295,12 @@ in { ]; }) ]; + + pushgateway = { + enable = true; + }; }; + users.users.${config.services.prometheus.exporters.unbound.user} = { description = "Prometheus unbound exporter service user"; isSystemUser = true; -- cgit v1.2.3