postfix-stats/grapher.sh

101 lines
3.8 KiB
Bash
Executable File

#!/bin/bash
# Go into appropriate directory
cd `dirname $0`
# Load settings
. ./settings.sh
rrdtool graph $GRAPHDIR/hour.png \
--start end-1h \
--step 60 \
--title "Mail statistics for `hostname -f`" \
--vertical-label "mails/minute" \
-h 200 -w 800 --slope-mode \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \
DEF:mail_reputation=$RRDFILE:mail_reputation:AVERAGE \
AREA:mail_deferred#77777733: \
LINE:mail_deferred#777777:'deferred': \
AREA:mail_sent#00DD0055: \
LINE:mail_sent#00DD00:'sent': \
AREA:mail_bounced_total#0000FF77: \
LINE:mail_bounced_total#0000FF:'bounced total': \
AREA:mail_bounced_spam#FF0000AA: \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM': \
AREA:mail_reputation#FF00FFFF: \
LINE:mail_reputation#FF00FFFF:'reputation event':
rrdtool graph $GRAPHDIR/6hour.png \
--start end-6h \
--step 60 \
--title "Mail statistics for `hostname -f`" \
--vertical-label "mails/minute" \
-h 200 -w 800 --slope-mode \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \
DEF:mail_reputation=$RRDFILE:mail_reputation:AVERAGE \
AREA:mail_deferred#77777733: \
LINE:mail_deferred#777777:'deferred': \
AREA:mail_sent#00DD0055: \
LINE:mail_sent#00DD00:'sent': \
AREA:mail_bounced_total#0000FF77: \
LINE:mail_bounced_total#0000FF:'bounced total': \
AREA:mail_bounced_spam#FF0000AA: \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM': \
AREA:mail_reputation#FF00FFFF: \
LINE:mail_reputation#FF00FFFF:'reputation event':
rrdtool graph $GRAPHDIR/day.png \
--start end-24h \
--step 60 \
--title "Mail statistics for `hostname -f`" \
--vertical-label "mails/minute" \
-h 200 -w 800 --slope-mode \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \
DEF:mail_reputation=$RRDFILE:mail_reputation:AVERAGE \
AREA:mail_deferred#77777733: \
LINE:mail_deferred#777777:'deferred': \
AREA:mail_sent#00DD0055: \
LINE:mail_sent#00DD00:'sent': \
AREA:mail_bounced_total#0000FF77: \
LINE:mail_bounced_total#0000FF:'bounced total': \
AREA:mail_bounced_spam#FF0000AA: \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM': \
AREA:mail_reputation#FF00FFFF: \
LINE:mail_reputation#FF00FFFF:'reputation event':
rrdtool graph $GRAPHDIR/week.png \
--start end-7d \
--step 60 \
--title "Mail statistics for `hostname -f`" \
--vertical-label "mails/minute" \
-h 200 -w 800 --slope-mode \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \
DEF:mail_reputation=$RRDFILE:mail_reputation:AVERAGE \
AREA:mail_deferred#77777733: \
LINE:mail_deferred#777777:'deferred': \
AREA:mail_sent#00DD0055: \
LINE:mail_sent#00DD00:'sent': \
AREA:mail_bounced_total#0000FF77: \
LINE:mail_bounced_total#0000FF:'bounced total': \
AREA:mail_bounced_spam#FF0000AA: \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM': \
AREA:mail_reputation#FF00FFFF: \
LINE:mail_reputation#FF00FFFF:'reputation event':