55 lines
1.4 KiB
Bash
Executable file
55 lines
1.4 KiB
Bash
Executable file
#!/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:temp0_hd:GAUGE:600:U:U \
|
|
DS:temp1_hd:GAUGE:600:U:U \
|
|
RRA:AVERAGE:0.5:1:288
|
|
fi
|
|
|
|
|
|
TEMP0=`smartctl -a /dev/ad0 | grep Temperature_Celsius | cut -c 88-89`
|
|
TEMP1=`smartctl -a /dev/ad1 | grep Temperature_Celsius | cut -c 88-89`
|
|
|
|
${RRD} update ${DBASE} N:${TEMP0}:${TEMP1}
|
|
|
|
${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:temp0="${DBASE}":temp0_hd:AVERAGE \
|
|
DEF:temp1="${DBASE}":temp1_hd:AVERAGE \
|
|
AREA:temp0#00CF00:"ad0\t" GPRINT:temp0:LAST:"Last\:%4.0lf %s" GPRINT:temp0:AVERAGE:"Avg\:%4.0lf %s" GPRINT:temp0:MAX:"Max\:%4.0lf %s\n" \
|
|
LINE1:temp1#FF0000:"ad1\t" GPRINT:temp1:LAST:"Last\:%4.0lf %s" GPRINT:temp1:AVERAGE:"Avg\:%4.0lf %s" GPRINT:temp1: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:temp0="${DBASE}":temp0_hd:AVERAGE \
|
|
DEF:temp1="${DBASE}":temp1_hd:AVERAGE \
|
|
AREA:temp0#00CF00: \
|
|
LINE1:temp1#FF0000:
|