#!/bin/bash # Go into appropriate directory cd `dirname $0` # Load settings . ./settings.sh period_filenames=("hour.png" "6hours.png" "12hours.png" "day.png" "week.png" "month.png" "6months.png" "year.png") period_startparams=("end-1h" "end-6h" "end-12h" "end-24h" "end-7d" "end-4w" "end-6M" "end-1y") period_texts=("Last hour" "Last 6 hours" "Last 12 hours" "Last day" "Last week" "Last month" "Last 6 months" "Last year") for index in ${!period_filenames[*]}; do filename=${period_filenames[$index]} startparam=${period_startparams[$index]} text=${period_texts[$index]} # Draw the graphs # Logfile rrdtool graph $GRAPHDIR/log_$filename \ --start $startparam \ --step 60 \ --title "Mail logfile statistics on `hostname -f` - $text" \ --vertical-label "lines/minute" \ -h 200 -w 800 --slope-mode --watermark "`date`" \ DEF:log_lines_total=$RRDFILE:log_lines_total:AVERAGE \ DEF:log_lines_smtp=$RRDFILE:log_lines_smtp:AVERAGE \ DEF:log_lines_smtpd=$RRDFILE:log_lines_smtpd:AVERAGE \ AREA:log_lines_total#00000033 \ LINE:log_lines_total#000000:'total' \ AREA:log_lines_smtp#FF000055 \ LINE:log_lines_smtp#FF0000:'smtp' \ AREA:log_lines_smtpd#0000FF77 \ LINE:log_lines_smtpd#0000FF:'smtpd' # Connections rrdtool graph $GRAPHDIR/connections_$filename \ --start $startparam \ --step 60 \ --title "Inbound mail connections on `hostname -f` - $text" \ --vertical-label "connections/minute" \ -h 200 -w 800 --slope-mode --watermark "`date`" \ DEF:mi_connects=$RRDFILE:mi_connects:AVERAGE \ DEF:mi_connects_tls=$RRDFILE:mi_connects_tls:AVERAGE \ AREA:mi_connects#CC000033 \ LINE:mi_connects#CC0000:'total' \ AREA:mi_connects_tls#00FF0055 \ LINE:mi_connects_tls#00FF00:'with tls' # Outbound mail rrdtool graph $GRAPHDIR/mail_out_$filename \ --start $startparam \ --step 60 \ --title "Outbound mail on `hostname -f` - $text" \ --vertical-label "mails/minute" \ -h 200 -w 800 --slope-mode --watermark "`date`" \ DEF:mo_sent=$RRDFILE:mo_sent:AVERAGE \ DEF:mo_deferred=$RRDFILE:mo_deferred:AVERAGE \ DEF:mo_bncd_total=$RRDFILE:mo_bncd_total:AVERAGE \ DEF:mo_bncd_spam=$RRDFILE:mo_bncd_spam:AVERAGE \ DEF:mo_bncd_reputation=$RRDFILE:mo_bncd_reputation:AVERAGE \ DEF:mo_deliverable=$RRDFILE:mo_deliverable:AVERAGE \ DEF:mo_undeliverable=$RRDFILE:mo_undeliverable:AVERAGE \ AREA:mo_deferred#77777733 \ LINE:mo_deferred#777777:'deferred' \ AREA:mo_sent#00DD0055 \ LINE:mo_sent#00DD00:'sent' \ AREA:mo_deliverable#00AA0077 \ LINE:mo_deliverable#00AA00:'deliverable' \ AREA:mo_undeliverable#AA880077 \ LINE:mo_undeliverable#AA8800:'undeliverable' \ AREA:mo_bncd_total#0000FF77 \ LINE:mo_bncd_total#0000FF:'bounced total' \ AREA:mo_bncd_spam#FF0000AA \ LINE:mo_bncd_spam#FF0000:'bounced due to SPAM' \ AREA:mo_bncd_reputation#FF00FFFF \ LINE:mo_bncd_reputation#FF00FFFF:'reputation event' # Inbound mail rrdtool graph $GRAPHDIR/mail_in_$filename \ --start $startparam \ --step 60 \ --title "Inbound mail on `hostname -f` - $text" \ --vertical-label "mails/minute" \ -h 200 -w 800 --slope-mode --watermark "`date`" \ DEF:mi_accept=$RRDFILE:mi_accept:AVERAGE \ DEF:mi_reject=$RRDFILE:mi_reject:AVERAGE \ DEF:mi_proxy_accept=$RRDFILE:mi_proxy_accept:AVERAGE \ DEF:mi_proxy_reject=$RRDFILE:mi_proxy_reject:AVERAGE \ AREA:mi_accept#00FF0033 \ LINE:mi_accept#00FF00:'accept' \ AREA:mi_proxy_accept#00880055 \ LINE:mi_proxy_accept#008800:'proxy-accept' \ AREA:mi_reject#FF000077 \ LINE:mi_reject#FF0000:'reject' \ AREA:mi_proxy_reject#88000077 \ LINE:mi_proxy_reject#880000:'proxy-reject' done