#!/bin/sh BASEDIR=`pwd` . ${BASEDIR%scripts}/rrdtool.conf FILE="hd-server" DBASE="${DBASEDIR}/${FILE}.rrd" IMG="${IMGDIR}/${FILE}.png" SIMG="${IMGDIR}/small-${FILE}.png" if [ ! -f "${DBASE}" ]; then ${RRD} create ${DBASE} \ --start N \ --step 300 \ DS:hd_srv:GAUGE:600:U:U \ RRA:AVERAGE:0.5:1:288 fi ${RRD} update ${DBASE} N:`df | grep /dev/ad0s1a | awk '{gsub("%", ""); print $(NF-1)}'` ${RRD} graph ${IMG} \ --imgformat=PNG \ --title="HD space" \ --font LEGEND:7 \ --rigid \ --base=1000 \ --height=100 \ --width=400 \ --tabwidth=20 \ --upper-limit=100 \ --lower-limit=0 \ --vertical-label="hd usage %" \ DEF:hd="${DBASE}":hd_srv:AVERAGE \ AREA:hd#00CF00:"SPACE USED\t" GPRINT:hd:LAST:"Last\:%4.0lf %s" GPRINT:hd:AVERAGE:"Avg\:%4.0lf %s" GPRINT:hd:MAX:"Max\:%4.0lf %s" ${RRD} graph ${SIMG} \ --imgformat=PNG \ --font DEFAULT:5 \ --height=50 \ --width=200 \ --tabwidth=20 \ --lower-limit=0 \ --no-legend \ DEF:hd="${DBASE}":hd_srv:AVERAGE \ AREA:hd#00CF00