47 lines
1,007 B
Bash
47 lines
1,007 B
Bash
|
|
#!/bin/sh
|
||
|
|
|
||
|
|
BASEDIR=`pwd`
|
||
|
|
. ${BASEDIR%scripts}/rrdtool.conf
|
||
|
|
|
||
|
|
FILE="temp-hd"
|
||
|
|
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:temp_hd:GAUGE:600:U:U \
|
||
|
|
RRA:AVERAGE:0.5:1:288
|
||
|
|
fi
|
||
|
|
|
||
|
|
${RRD} update ${DBASE} N:`smartctl -a /dev/ad0 | grep Temperature_Celsius | cut -c 88-89`
|
||
|
|
|
||
|
|
${RRD} graph ${IMG} \
|
||
|
|
--imgformat=PNG \
|
||
|
|
--title="HD Temperature" \
|
||
|
|
--font LEGEND:7 \
|
||
|
|
--rigid \
|
||
|
|
--base=1000 \
|
||
|
|
--height=100 \
|
||
|
|
--width=400 \
|
||
|
|
--upper-limit=100 \
|
||
|
|
--tabwidth=20 \
|
||
|
|
--lower-limit=0 \
|
||
|
|
--vertical-label="celsius" \
|
||
|
|
DEF:temp="${DBASE}":temp_hd:AVERAGE \
|
||
|
|
AREA:temp#00CF00:"TEMP\t" GPRINT:temp:LAST:"Last\:%4.0lf %s" GPRINT:temp:AVERAGE:"Avg\:%4.0lf %s" GPRINT:temp: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:temp="${DBASE}":temp_hd:AVERAGE \
|
||
|
|
AREA:temp#00CF00:
|