From d79ea28fafe7ee68ef1de3ab8d5556a37dab010f Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme <jan.philipp@timme.it> Date: Tue, 6 Aug 2019 16:31:59 +0200 Subject: [PATCH] Add Readme.md, fix broken line --- Readme.md | 10 ++++++++++ postfix-stats.sh | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..c06afbe --- /dev/null +++ b/Readme.md @@ -0,0 +1,10 @@ +# check-mk-postfix-logstats + +This is a fairly simple plugin for linux check_mk agents which parses your postfix logfile and returns a bunch of numbers. + +# Installation + +* Clone this repository into e.g. `/opt/check-mk-postfix-stats`. +* Edit the `settings.sh` (There is not much to do) +* Symlink `postfix-stats.sh` to `/usr/lib/check_mk_agent/plugins` + diff --git a/postfix-stats.sh b/postfix-stats.sh index 7cb7044..aafac3c 100755 --- a/postfix-stats.sh +++ b/postfix-stats.sh @@ -81,8 +81,7 @@ mo_deferred=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE mo_deliverable=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=deliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) mo_undeliverable=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=undeliverable' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) mo_bncd_total=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) -mo_bncd_spam=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -i 'spam' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc --l) +mo_bncd_spam=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep 'status=bounced' | grep -i 'spam' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) mo_bncd_reputation=$( sed -n "$old_log_position","$new_log_position"p $LOGFILE | grep '\/smtp\[' | grep -i 'reputation' | grep -v 'relay=127\.0\.0\.1\|relay=localhost\|relay=::1' | wc -l) # Collect inbound email statistics -- GitLab