From 197956ea9002b78ec28074fd00fbca56625be0db Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Thu, 2 May 2024 11:23:13 +0200 Subject: [PATCH] prometheus: patch the postfix exporter to catch rspamd rejects --- overlays/default.nix | 5 +++- ...001-cleanup-also-catch-milter-reject.patch | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 overlays/prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch diff --git a/overlays/default.nix b/overlays/default.nix index d5b5aae..d5d37e5 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -13,7 +13,10 @@ in }; })); # (hopefully) fix systemd journal reading - prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (old: rec { + prometheus-postfix-exporter = prev.prometheus-postfix-exporter.overrideAttrs (old: { + patches = [ + ./prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch + ]; src = fetchFromGitHub { owner = "adangel"; repo = "postfix_exporter"; diff --git a/overlays/prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch b/overlays/prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch new file mode 100644 index 0000000..2b60316 --- /dev/null +++ b/overlays/prometheus-postfix-exporter/0001-cleanup-also-catch-milter-reject.patch @@ -0,0 +1,25 @@ +From f4c5dd5628c873981b2d6d6b8f3bbf036b9fd724 Mon Sep 17 00:00:00 2001 +From: Rouven Seifert +Date: Thu, 2 May 2024 11:20:27 +0200 +Subject: [PATCH] cleanup: also catch milter-reject + +--- + postfix_exporter.go | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/postfix_exporter.go b/postfix_exporter.go +index f20d99c..676d767 100644 +--- a/postfix_exporter.go ++++ b/postfix_exporter.go +@@ -335,6 +335,8 @@ func (e *PostfixExporter) CollectFromLogLine(line string) { + e.cleanupProcesses.Inc() + } else if strings.Contains(remainder, ": reject: ") { + e.cleanupRejects.Inc() ++ } else if strings.Contains(remainder, ": milter-reject: ") { ++ e.cleanupRejects.Inc() + } else { + e.addToUnsupportedLine(line, subprocess, level) + } +-- +2.44.0 +