Fix grapher

This commit is contained in:
Jan Philipp Timme 2018-05-04 15:34:50 +02:00
parent 11fd5e0a71
commit cda058b33d
1 changed files with 37 additions and 134 deletions

View File

@ -6,141 +6,44 @@ cd `dirname $0`
# Load settings # Load settings
. ./settings.sh . ./settings.sh
rrdtool graph $GRAPHDIR/hour.png \ period_filenames=("hour.png" "6hours.png" "day.png" "week.png" "month.png" "6months.png" "year.png")
--start end-1h \ period_startparams=("end-1h" "end-6h" "end-24h" "end-7d" "end-1m" "end-6m" "end-1y")
period_texts=("Last hour" "Last 6 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
# Outbound mail
rrdtool graph $GRAPHDIR/$filename \
--start $startparam \
--step 60 \ --step 60 \
--title "Mail statistics for `hostname -f` - Last hour" \ --title "Mail statistics for `hostname -f` - $text" \
--vertical-label "mails/minute" \ --vertical-label "mails/minute" \
-h 200 -w 800 --slope-mode \ -h 200 -w 800 --slope-mode \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \ DEF:mo_sent=$RRDFILE:mo_sent:AVERAGE \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \ DEF:mo_deferred=$RRDFILE:mo_deferred:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \ DEF:mo_bounced_total=$RRDFILE:mo_bounced_total:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \ DEF:mo_bounced_spam=$RRDFILE:mo_bounced_spam:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \ DEF:mo_bounced_reputation=$RRDFILE:mo_bounced_reputation:AVERAGE \
DEF:mail_bounced_reputation=$RRDFILE:mail_bounced_reputation:AVERAGE \ DEF:mo_deliverable=$RRDFILE:mo_deliverable:AVERAGE \
AREA:mail_deferred#77777733 \ DEF:mo_undeliverable=$RRDFILE:mo_undeliverable:AVERAGE \
LINE:mail_deferred#777777:'deferred' \ AREA:mo_deferred#77777733 \
AREA:mail_sent#00DD0055 \ LINE:mo_deferred#777777:'deferred' \
LINE:mail_sent#00DD00:'sent' \ AREA:mo_sent#00DD0055 \
AREA:mail_bounced_total#0000FF77 \ LINE:mo_sent#00DD00:'sent' \
LINE:mail_bounced_total#0000FF:'bounced total' \ AREA:mo_deliverable#00AA0077 \
AREA:mail_bounced_spam#FF0000AA \ LINE:mo_deliverable#00AA00:'deliverable' \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM' \ AREA:mo_undeliverable#AA880077 \
AREA:mail_bounced_reputation#FF00FFFF \ LINE:mo_undeliverable#AA8800:'undeliverable' \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event' AREA:mo_bounced_total#0000FF77 \
LINE:mo_bounced_total#0000FF:'bounced total' \
rrdtool graph $GRAPHDIR/6hour.png \ AREA:mo_bounced_spam#FF0000AA \
--start end-6h \ LINE:mo_bounced_spam#FF0000:'bounced due to SPAM' \
--step 60 \ AREA:mo_bounced_reputation#FF00FFFF \
--title "Mail statistics for `hostname -f` - Last 6 hours" \ LINE:mo_bounced_reputation#FF00FFFF:'reputation event'
--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_bounced_reputation=$RRDFILE:mail_bounced_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_bounced_reputation#FF00FFFF \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event'
rrdtool graph $GRAPHDIR/day.png \
--start end-24h \
--step 60 \
--title "Mail statistics for `hostname -f` - Last day" \
--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_bounced_reputation=$RRDFILE:mail_bounced_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_bounced_reputation#FF00FFFF \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event'
rrdtool graph $GRAPHDIR/week.png \
--start end-7d \
--step 60 \
--title "Mail statistics for `hostname -f` - Last week" \
--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_bounced_reputation=$RRDFILE:mail_bounced_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_bounced_reputation#FF00FFFF \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event'
rrdtool graph $GRAPHDIR/month.png \
--start end-1m \
--step 60 \
--title "Mail statistics for `hostname -f` - Last month" \
--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_bounced_reputation=$RRDFILE:mail_bounced_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_bounced_reputation#FF00FFFF \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event'
rrdtool graph $GRAPHDIR/year.png \
--start end-1y \
--step 60 \
--title "Mail statistics for `hostname -f` - Last year" \
--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_bounced_reputation=$RRDFILE:mail_bounced_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_bounced_reputation#FF00FFFF \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event'
done