diff --git a/plugins/other/mail_connections b/plugins/other/mail_connections new file mode 100755 index 00000000..0a59cbef --- /dev/null +++ b/plugins/other/mail_connections @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Plugin to count the open connections for smtp, pop3 and imap +# +# Magic markers - optional - used by installation scripts and +# munin-config: +# +#%# family=auto +#%# capabilities=autoconf + +PORTS="25 smtp SMTP + 110 pop3 POP3 + 143 imap IMAP + 465 ssmtp SMTP-SSL + 587 submission SMTP (submission) + 993 imaps IMAP-SSL + 995 pop3s POP3-SSL" + +if [ "$1" = "autoconf" ]; then + ports=$(echo "$PORTS" | cut -f 1 -d " ") + for port in $ports; do + netstat -ln | grep -q ":$port " && echo "yes" && exit 0 + done + # no open connections for typical mail ports found + echo "no (no listeners for smtp/pop3/imap ports found)" + exit 0 +fi + +if [ "$1" = "config" ]; then + cat <