Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Administrators

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-01-2009, 12:09 PM
Member
 
Posts: 11
Lightbulb Attachment Blocking Stats

I noticed that the daily mail report doesn't report on attachment blocking statistics. Here's a script to get statistics for attachment block by the MTA. It could easily be extended to email in CSV format.

Code:
#!/bin/bash
#This script counts how many of each attachment extension were blocked by the MTA,
#If no messages for that extension were blocked they are omitted from the count
#created by james[dot]barnett[at]noc[dot]com

clear
cd /home/zimbra
zmprov gcf zimbraMtaBlockedExtension | cut -d: -f2>temp.txt #echo blocked attachment extensions to temp file
total=0;

echo "Number of Messages blocked by the MTA due to Attachments with banned Extensions"
echo
echo -e "Number \t | \t Extension"
for i in $(cat temp.txt); #reads the list into $i
do
        count=$(grep -c "unacceptable extension \"$i\"" /var/log/zimbra.log) #counts the number of occurences in the log of $i
        if [ "$count" -gt "1" ] #checks to see if count is greater than 1 if not then don't print report that extension
                then echo -e "$count \t | \t $i"
        fi
        if [ "$count" = "1" ] #checks to see if count is 1 (for grammatically correct output)
                then echo -e "$count \t | \t $i"
        fi
        let total+="$count" #adds the value of count to the total
done
tput smso;
echo -e "$total \t | \t total"
tput rmso;
echo
rm -f temp.txt #removes temp file
Reply With Quote
  #2 (permalink)  
Old 05-19-2012, 04:31 AM
Junior Member
 
Posts: 9
Default

hello! can be used eg newer version. 7
As can be run as root or user zimbra?
cd /home/Zimbra is the path where is installed, will be changed to /opt/Zimbra
thanks
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.