51 lines
1.5 KiB
Bash
51 lines
1.5 KiB
Bash
|
|
#!/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:hd0_srv:GAUGE:600:U:U \
|
||
|
|
DS:hd1_srv:GAUGE:600:U:U \
|
||
|
|
RRA:AVERAGE:0.5:1:288
|
||
|
|
fi
|
||
|
|
|
||
|
|
HD0SPACE=`df | grep /dev/ad0s1a | awk '{gsub("%", ""); print $(NF-1)}'`
|
||
|
|
HD1SPACE=`df | grep /dev/ad1s1a | awk '{gsub("%", ""); print $(NF-1)}'`
|
||
|
|
|
||
|
|
${RRD} update ${DBASE} N:${HD0SPACE}:${HD1SPACE}
|
||
|
|
|
||
|
|
${RRD} graph ${IMG} \
|
||
|
|
--imgformat=PNG \
|
||
|
|
--title="HD space" \
|
||
|
|
--font LEGEND:7 \
|
||
|
|
--width=400 \
|
||
|
|
--tabwidth=20 \
|
||
|
|
--lower-limit=0 \
|
||
|
|
--vertical-label="hd usage %" \
|
||
|
|
DEF:hd0="${DBASE}":hd0_srv:AVERAGE \
|
||
|
|
DEF:hd1="${DBASE}":hd1_srv:AVERAGE \
|
||
|
|
AREA:hd0#00CF00:"ad0 usage\t" GPRINT:hd0:LAST:"Last\:%4.0lf %s" GPRINT:hd0:AVERAGE:"Avg\:%4.0lf %s" GPRINT:hd0:MAX:"Max\:%4.0lf %s\n" \
|
||
|
|
LINE1:hd1#002A97:"ad1 usage\t" GPRINT:hd1:LAST:"Last\:%4.0lf %s" GPRINT:hd1:AVERAGE:"Avg\:%4.0lf %s" GPRINT:hd1: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:hd0="${DBASE}":hd0_srv:AVERAGE \
|
||
|
|
DEF:hd1="${DBASE}":hd1_srv:AVERAGE \
|
||
|
|
AREA:hd0#00CF00 \
|
||
|
|
LINE1:hd1#002A97
|