EzyMailHostingAdministration

How to monitor messages statistics of Zimbra mail server

Zimbra Email serviceZimbra provides monitoring that helps us check system status and performance effectively. However, it lacks monitoring of email sending and receiving statistics. This information would help administrators spot delivery anomalies promptly, such as a leaked password allowing a spammer to send a huge volume of mail through the system, creating a risk of blacklisting. Configuring the system to Monitor messages statistics

  1. Install logcheck.

    [root@EzyMailHosting ~]# yum install logcheck
  2. Create zabbix-postfix.sh in /opt with the following contents.

    
    #!/bin/bash
    
    MAILLOG=/var/log/maillog
    DAT1=/tmp/zabbix-postfix-offset.dat
    DAT2=/tmp/zabbix-postfix-offset-2.dat
    PFLOGSUMM= /opt/zimbra/libexec/pflogsumm.pl
    ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
    RESULT_STATUS=/tmp/tmp_postfix_result
    
    /usr/sbin/logtail -f$MAILLOG -o$DAT1 | $PFLOGSUMM -h 0 -u 0 --no_bounce_detail --no_deferral_detail --no_reject_detail --no_no_msg_size --no_smtpd_warnings > $DAT2
    
    echo "- postfix.received `grep -m 1 received $DAT2|cut -f1 -d"r"`" > $RESULT_STATUS
    echo "- postfix.delivered `grep -m 1 delivered $DAT2|cut -f1 -d"d"`" >> $RESULT_STATUS
    echo "- postfix.forwarded `grep -m 1 forwarded $DAT2|cut -f1 -d"f"`" >> $RESULT_STATUS
    echo "- postfix.deferred `grep -m 1 deferred $DAT2|cut -f1 -d"d"`" >> $RESULT_STATUS
    echo "- postfix.bounced `grep -m 1 bounced $DAT2|cut -f1 -d"b"`" >> $RESULT_STATUS
    echo "- postfix.rejected `grep -m 1 rejected $DAT2|cut -f1 -d"r"`" >> $RESULT_STATUS
    echo "- postfix.rejectwarnings `grep -m 1 "reject warnings" $DAT2|cut -f1 -d"r"`" >> $RESULT_STATUS
    echo "- postfix.held `grep -m 1 held $DAT2|cut -f1 -d"h"`" >> $RESULT_STATUS
    echo "- postfix.discarded `grep -m 1 discarded $DAT2|cut -f1 -d"d"`" >> $RESULT_STATUS
    echo "- postfix.bytesreceived `grep -m 1 "bytes received" $DAT2|cut -f1 -d"b"`" >> $RESULT_STATUS
    echo "- postfix.bytesdelivered `grep -m 1 "bytes delivered" $DAT2|cut -f1 -d"b"`" >> $RESULT_STATUS
    
    /usr/bin/zabbix_sender -c $ZABBIX_CONF -i $RESULT_STATUS
    
    rm $DAT2
  3. Add the following cron entry so the script sends statistics to the ZABBIX server.

    */30 * * * * /opt/zabbix-postfix.sh &>/dev/null
  4. Download the XML file below, import it into ZABBIX, and apply the template to the Zimbra server. Postfix Statistics_xml

EOF.← Back to articles