1
0
mirror of https://lab.it.hs-hannover.de/misc/postfix-stats.git synced 2024-11-27 22:37:55 +01:00
postfix-stats/grapher.sh

101 lines
4.0 KiB
Bash
Raw Normal View History

2018-05-03 19:58:08 +02:00
#!/bin/bash
# Go into appropriate directory
cd `dirname $0`
# Load settings
. ./settings.sh
2018-05-04 16:12:53 +02:00
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")
2018-05-04 15:34:50 +02:00
for index in ${!period_filenames[*]}; do
filename=${period_filenames[$index]}
startparam=${period_startparams[$index]}
text=${period_texts[$index]}
# Draw the graphs
2018-05-04 15:57:45 +02:00
# Logfile
rrdtool graph $GRAPHDIR/log_$filename \
--start $startparam \
--step 60 \
--title "Mail logfile statistics on `hostname -f` - $text" \
--vertical-label "lines/minute" \
2018-05-07 15:54:17 +02:00
-h 200 -w 800 --slope-mode --watermark "`date`" \
2018-05-04 15:57:45 +02:00
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" \
2018-05-07 15:54:17 +02:00
-h 200 -w 800 --slope-mode --watermark "`date`" \
2018-05-04 15:57:45 +02:00
DEF:mi_connects=$RRDFILE:mi_connects:AVERAGE \
DEF:mi_connects_tls=$RRDFILE:mi_connects_tls:AVERAGE \
2018-05-04 16:01:12 +02:00
AREA:mi_connects#CC000033 \
LINE:mi_connects#CC0000:'total' \
AREA:mi_connects_tls#00FF0055 \
LINE:mi_connects_tls#00FF00:'with tls'
2018-05-04 15:57:45 +02:00
2018-05-04 15:34:50 +02:00
# Outbound mail
2018-05-04 15:57:45 +02:00
rrdtool graph $GRAPHDIR/mail_out_$filename \
2018-05-04 15:34:50 +02:00
--start $startparam \
--step 60 \
2018-05-04 15:57:45 +02:00
--title "Outbound mail on `hostname -f` - $text" \
2018-05-04 15:34:50 +02:00
--vertical-label "mails/minute" \
2018-05-07 15:54:17 +02:00
-h 200 -w 800 --slope-mode --watermark "`date`" \
2018-05-04 15:34:50 +02:00
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 \
2018-05-04 15:34:50 +02:00
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'
2018-05-04 15:34:50 +02:00
2018-05-04 15:57:45 +02:00
# Inbound mail
rrdtool graph $GRAPHDIR/mail_in_$filename \
--start $startparam \
--step 60 \
--title "Inbound mail on `hostname -f` - $text" \
--vertical-label "mails/minute" \
2018-05-07 15:54:17 +02:00
-h 200 -w 800 --slope-mode --watermark "`date`" \
2018-05-04 15:57:45 +02:00
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'
2018-05-04 15:34:50 +02:00
done