diff options
author | David Runge <dave@sleepmap.de> | 2017-06-27 14:18:16 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2017-06-27 14:18:16 +0200 |
commit | 32a18ea803262e9663e35da7f783565584b0ae0e (patch) | |
tree | f9595cabd48c938c042dbeaf83b7902fd14e8d27 | |
parent | 67c5bfa895a6fb629eb35c9df9daaa54dbc3091b (diff) | |
download | dotfiles-32a18ea803262e9663e35da7f783565584b0ae0e.tar.gz dotfiles-32a18ea803262e9663e35da7f783565584b0ae0e.tar.bz2 dotfiles-32a18ea803262e9663e35da7f783565584b0ae0e.tar.xz dotfiles-32a18ea803262e9663e35da7f783565584b0ae0e.zip |
bin/get_mail_stats: Adding script to show simple stats of mails received, dropped, spammed of current day.
-rwxr-xr-x | bin/get_mail_stats | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bin/get_mail_stats b/bin/get_mail_stats new file mode 100755 index 0000000..2a07b73 --- /dev/null +++ b/bin/get_mail_stats @@ -0,0 +1,22 @@ +#! /usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +set +e +postfix_received=$(journalctl --since "0:00" _EXE=/usr/lib/postfix/bin/smtpd|grep "proxy-accept"| wc -l) +rbl_dropped=$(journalctl --since "0:00" -u postfix |grep "Service unavailable"|wc -l) +spampd_clean=$(journalctl --since "0:00" -u spampd| grep "clean message"| wc -l) +spampd_spam=$(journalctl --since "0:00" -u spampd| grep "identified spam"| wc -l) +sieve_spam=$(journalctl --since "0:00" _EXE=/usr/lib/dovecot/dovecot-lda| grep "Spam"| wc -l) +postfix_sent=$(journalctl --since "0:00" _EXE=/usr/lib/postfix/bin/smtp |grep "sent"| wc -l) +date=$(date -I) +set -e + +echo "Mail statistics for $(hostname) on $date" +echo "Received total: $postfix_received" +echo "RBL dropped: $rbl_dropped" +echo "Spampd clean: $spampd_clean" +echo "Spampd spam: $spampd_spam" +echo "Sieve spam: $spampd_spam" +echo "Sent: $postfix_sent" |