#!/bin/bash

# adjust to your httpds doc_root
HTTP_ROOT=/tmp/www
# HTTP_ROOT=/var/www 		# default debian
# HTTP_ROOT=/srv/www/htdocs 	# default SuSE
# HTTP_ROOT=/var/www/html       # default RedHat

echo "Copying xmailgraph.pl to /var/MailRoot/bin/"
cp xmailgraph.pl /var/MailRoot/bin/

echo "Creating Directory under your httpds doc_root"
mkdir $HTTP_ROOT/xmailgraph

echo "Copying html-files"
cp *.html $HTTP_ROOT/xmailgraph/
cp *.gif $HTTP_ROOT/xmailgraph/

echo "Creating RRDs"
rrdtool create /var/MailRoot/logs/WN_xmail_smtp.rrd --start -601 --step 600 \
 DS:sent:ABSOLUTE:1200:0:U DS:recv:ABSOLUTE:1200:0:U DS:bounce:ABSOLUTE:1200:0:U \
 RRA:AVERAGE:0.5:1:198 RRA:AVERAGE:0.5:7:198 RRA:AVERAGE:0.5:35:198 RRA:AVERAGE:0.5:385:198 \
 RRA:MAX:0.5:1:198 RRA:MAX:0.5:7:198 RRA:MAX:0.5:35:198 RRA:MAX:0.5:385:198

rrdtool create /var/MailRoot/logs/WN_xmail_spam.rrd --start -601 --step 600 \
 DS:spam1:ABSOLUTE:1200:0:U DS:spam2:ABSOLUTE:1200:0:U \
 RRA:AVERAGE:0.5:1:198 RRA:AVERAGE:0.5:7:198 RRA:AVERAGE:0.5:35:198 RRA:AVERAGE:0.5:385:198 \
 RRA:MAX:0.5:1:198 RRA:MAX:0.5:7:198 RRA:MAX:0.5:35:198 RRA:MAX:0.5:385:198

rrdtool create /var/MailRoot/logs/WN_xmail_pop3.rrd --start -601 --step 600 \
 DS:pop3:ABSOLUTE:1200:0:U \
 RRA:AVERAGE:0.5:1:198 RRA:AVERAGE:0.5:7:198 RRA:AVERAGE:0.5:35:198 RRA:AVERAGE:0.5:385:198 \
 RRA:MAX:0.5:1:198 RRA:MAX:0.5:7:198 RRA:MAX:0.5:35:198 RRA:MAX:0.5:385:198

rrdtool create /var/MailRoot/logs/WN_xmail_antivirus.rrd --start -601 --step 600 \
 DS:virus:ABSOLUTE:1200:0:U \
 RRA:AVERAGE:0.5:1:198 RRA:AVERAGE:0.5:7:198 RRA:AVERAGE:0.5:35:198 RRA:AVERAGE:0.5:385:198 \
 RRA:MAX:0.5:1:198 RRA:MAX:0.5:7:198 RRA:MAX:0.5:35:198 RRA:MAX:0.5:385:198

echo "finished!"
echo " "
echo "Please Take a Look to /var/MailRoot/bin/xmailgraph.pl and "
echo "adjust at least the vars hostname, dir_of_pngs and others "
echo "if needed!"
echo " "
echo "have a lot of fun..."


