EzyMailHostingAdministration

How to monitor messages statistics of Zimbra mail server

Zimbra Email serviceระบบ Zimbra มีระบบ monitor ที่สามารถช่วยให้เราตรวจสอบสถานะการทำงานต่างๆ และตรวจสอบประสิทธิภาพการทำงานของระบบได้อย่างมีประสิทธิภาพ แต่ก็ยังขาดการตรวจสอบสถานะการรับส่ง email ซึ่งข้อมูลต่างๆนี้จะช่วยให้ผู้ดูแลระบบสามารถตรวจสอบความผิดปกติในการรับส่งได้อย่างทันท่วงที เช่น เกิดการรั่วไหลของ password จึงทำให้ spammer ใช้ส่งเมล์จำนวนมหาศาลออกจากระบบ ทำให้มีความเสี่ยงที่จะเกิดการขึ้น blacklist ขึ้นได้ วิธีการ config เพื่อให้ระบบสามารถ Monitor messages statistics

  1. ติดตั้ง logcheck

    [root@EzyMailHosting ~]# yum install logcheck
  2. สร้างไฟล์ zabbix-postfix.sh บน /opt โดยให้มีข้อมูลตามด้านล่าง

    
    #!/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. ทำการเพิ่ม cron ตามด้านล่างเพื่อให้ script ส่ง stats ต่างๆไปยัง ZABBIX server

    */30 * * * * /opt/zabbix-postfix.sh &>/dev/null
  4. Download XML ไฟล์ด้านล่างเพื่อนำไป Import ใส่ใน ZABBIX และ apply template ที่ Zimbra server Postfix Statistics_xml

EOF.← กลับไปอ่านบทความอื่น