From 702594ca64c6d9d7c29ee581a3ba1e1458746033 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 23 May 2021 13:58:24 +0200 Subject: refactor(ops): Break out prometheus-fail2ban-exporter module Break out the configuration for the prometheus fail2ban exporter, which is a simple python script that exports stats from fail2ban as a prometheus-scrapable textfile, from Mugwump into a reusable nixos module in //ops/nixos/modules. Change-Id: I5451c9c5de6c7bc4431150ae596a9c758bf1b693 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3136 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/prometheus-fail2ban-exporter/default.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 third_party/prometheus-fail2ban-exporter/default.nix (limited to 'third_party/prometheus-fail2ban-exporter') diff --git a/third_party/prometheus-fail2ban-exporter/default.nix b/third_party/prometheus-fail2ban-exporter/default.nix new file mode 100644 index 000000000000..bed5bd630161 --- /dev/null +++ b/third_party/prometheus-fail2ban-exporter/default.nix @@ -0,0 +1,17 @@ +{ pkgs, ... }: + +let + script = pkgs.fetchurl { + url = "https://raw.githubusercontent.com/jangrewe/prometheus-fail2ban-exporter/11066950b47bb2dbef96ea8544f76e46ed829e81/fail2ban-exporter.py"; + sha256 = "049lsvw1nj65bbvp8ygyz3743ayzdawrbjixaxmpm03qbrcfmwc4"; + }; + + python = pkgs.python3.withPackages (p: [ + p.prometheus_client + ]); + +in pkgs.writeShellScriptBin "prometheus-fail2ban-exporter" '' + set -eo pipefail + + exec "${python}/bin/python" "${script}" +'' -- cgit 1.4.1