51 lines
1.2 KiB
Bash
51 lines
1.2 KiB
Bash
|
|
#!/bin/sh
|
||
|
|
|
||
|
|
DBASE="/usr/local/www/data/rrdtools/dbase/temp-hd.rrd"
|
||
|
|
IMG="/usr/local/www/data/rrdtools/pics/temp-hd.png"
|
||
|
|
SIMG="/usr/local/www/data/rrdtools/pics/small-temp-hd.png"
|
||
|
|
RRD="/usr/local/bin/rrdtool"
|
||
|
|
TEMP=`/usr/local/sbin/smartctl -a /dev/ad0 | /usr/bin/grep Temperature_Celsius | /usr/bin/cut -c 88-89`
|
||
|
|
|
||
|
|
# RRA = 1 giorno
|
||
|
|
|
||
|
|
# Aggiungere :
|
||
|
|
# RRA:AVERAGE:0.5:288:31
|
||
|
|
# per salvare il report mensile
|
||
|
|
|
||
|
|
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:${TEMP}
|
||
|
|
|
||
|
|
${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:
|