#!/bin/bash # rrdtool info /var/lib/collectd/rrd/zareason2/df-digital-assets/df_complex-free.rrd # rrdtool dump /var/lib/collectd/rrd/zareason2/df-digital-assets/df_complex-free.rrd # --start now-548d \ set -eu set -o pipefail width=890 height=420 function graph { infile="$1" outfile="$2" label="$3" # Was 1150x580 # 1920x1003 # --width 1780 \ # --height 840 \ if ! output=$(rrdtool \ graph "$outfile" \ --start now-90d \ --end now \ --width "$width" \ --height "$height" \ --right-axis 1:0 \ DEF:ds1a="$infile":value:AVERAGE LINE1:ds1a#FF0000:"$label" 2>&1) then echo "$0: Error running rrdtool" 1>&2 echo "$output" 1>&2 exit 1 fi } case "$(id -u)" in 0) echo "$0: Run me as a regular user, not root" 1>&2 exit 1 ;; esac mkdir -p ~/graphs graph \ /var/lib/collectd/rrd/"$(hostname)"/df-mnt-backshift/df_complex-free.rrd \ ~/graphs/backshift.png \ "backshift free space $(date '+%Y-%m-%d %I\:%M%p')" graph \ /var/lib/collectd/rrd/"$(hostname)"/df-mymount-digital-assets/df_complex-free.rrd \ ~/graphs/mymount-movie.png \ "digital-assets free space $(date '+%Y-%m-%d %I\:%M%p')" graph \ /var/lib/collectd/rrd/"$(hostname)"/df-mymount-public_html/df_complex-free.rrd \ ~/graphs/mymount-public_html.png \ "connserv (public_html and SVN) free space $(date '+%Y-%m-%d %I\:%M%p')" xzgv --zoom -g $((width*2))x$((height*2)) ~/graphs/*