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")
--step 60 \ period_texts=("Last hour" "Last 6 hours" "Last day" "Last week" "Last month" "Last 6 months" "Last year")
--title "Mail statistics for `hostname -f` - Last hour" \
--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/6hour.png \ for index in ${!period_filenames[*]}; do
--start end-6h \ filename=${period_filenames[$index]}
--step 60 \ startparam=${period_startparams[$index]}
--title "Mail statistics for `hostname -f` - Last 6 hours" \ text=${period_texts[$index]}
--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 \ # Draw the graphs
--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 \ # Outbound mail
--start end-7d \ rrdtool graph $GRAPHDIR/$filename \
--step 60 \ --start $startparam \
--title "Mail statistics for `hostname -f` - Last week" \ --step 60 \
--vertical-label "mails/minute" \ --title "Mail statistics for `hostname -f` - $text" \
-h 200 -w 800 --slope-mode \ --vertical-label "mails/minute" \
DEF:log_lines=$RRDFILE:log_lines:AVERAGE \ -h 200 -w 800 --slope-mode \
DEF:mail_sent=$RRDFILE:mail_sent:AVERAGE \ DEF:mo_sent=$RRDFILE:mo_sent:AVERAGE \
DEF:mail_deferred=$RRDFILE:mail_deferred:AVERAGE \ DEF:mo_deferred=$RRDFILE:mo_deferred:AVERAGE \
DEF:mail_bounced_total=$RRDFILE:mail_bounced_total:AVERAGE \ DEF:mo_bounced_total=$RRDFILE:mo_bounced_total:AVERAGE \
DEF:mail_bounced_spam=$RRDFILE:mail_bounced_spam:AVERAGE \ DEF:mo_bounced_spam=$RRDFILE:mo_bounced_spam:AVERAGE \
DEF:mail_bounced_reputation=$RRDFILE:mail_bounced_reputation:AVERAGE \ DEF:mo_bounced_reputation=$RRDFILE:mo_bounced_reputation:AVERAGE \
AREA:mail_deferred#77777733 \ DEF:mo_deliverable=$RRDFILE:mo_deliverable:AVERAGE \
LINE:mail_deferred#777777:'deferred' \ DEF:mo_undeliverable=$RRDFILE:mo_undeliverable:AVERAGE \
AREA:mail_sent#00DD0055 \ AREA:mo_deferred#77777733 \
LINE:mail_sent#00DD00:'sent' \ LINE:mo_deferred#777777:'deferred' \
AREA:mail_bounced_total#0000FF77 \ AREA:mo_sent#00DD0055 \
LINE:mail_bounced_total#0000FF:'bounced total' \ LINE:mo_sent#00DD00:'sent' \
AREA:mail_bounced_spam#FF0000AA \ AREA:mo_deliverable#00AA0077 \
LINE:mail_bounced_spam#FF0000:'bounced due to SPAM' \ LINE:mo_deliverable#00AA00:'deliverable' \
AREA:mail_bounced_reputation#FF00FFFF \ AREA:mo_undeliverable#AA880077 \
LINE:mail_bounced_reputation#FF00FFFF:'reputation event' LINE:mo_undeliverable#AA8800:'undeliverable' \
AREA:mo_bounced_total#0000FF77 \
rrdtool graph $GRAPHDIR/month.png \ LINE:mo_bounced_total#0000FF:'bounced total' \
--start end-1m \ AREA:mo_bounced_spam#FF0000AA \
--step 60 \ LINE:mo_bounced_spam#FF0000:'bounced due to SPAM' \
--title "Mail statistics for `hostname -f` - Last month" \ AREA:mo_bounced_reputation#FF00FFFF \
--vertical-label "mails/minute" \ LINE:mo_bounced_reputation#FF00FFFF:'reputation event'
-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