Kod: Markera allt
#!/bin/bash
OutsideTempSensor="28.B86392070000"
RRDDataDirectory="/home/mike/rrddata/"
RRDDataFile="outside_temp.rrd"
# Get temps from OWFS
outsidetemp=`cat /mnt/1wire/$OutsideTempSensor/temperature|sed -e s/" "//g|awk '{$1=$1 + 0.005;printf "%.2f", $1}'`
#Update RRD database
rrdtool update $RRDDataDirectory$RRDDataFile N:$outsidetemp
echo $outsidetemp
Kod: Markera allt
mike@mike-elvanas:~/rrddata$ ls -la
total 5496
drwxr-xr-x 2 mike mike 4096 Feb 8 23:05 .
drwxr-x--- 20 mike mike 4096 Feb 14 14:05 ..
-rwxr-xr-x 1 root root 865 Feb 8 23:03 create_rrd.sh
-rwxrwxrwx 1 mike mike 5614264 Feb 14 22:02 outside_temp.rrd
Kod: Markera allt
*/2.5 * * * * /home/mike/bin/get_temp.sh
*/2.5 * * * * export LANG=sv_SE.utf8 && /home/mike/bin/graph_temp.pl
Kod: Markera allt
mike@mike-elvanas:~/rrddata$ rrdtool lastupdate out*
outsidetemp
1707940201: 0,01
mike@mike-elvanas:~/rrddata$ rrdtool info out*
filename = "outside_temp.rrd"
rrd_version = "0003"
step = 150
last_update = 1707940201
header_size = 2872
ds[outsidetemp].index = 0
ds[outsidetemp].type = "GAUGE"
ds[outsidetemp].minimal_heartbeat = 300
ds[outsidetemp].min = -5.0000000000e+01
ds[outsidetemp].max = 6.0000000000e+01
ds[outsidetemp].last_ds = "0,01"
ds[outsidetemp].value = NaN
ds[outsidetemp].unknown_sec = 1
Kod: Markera allt
mike@mike-elvanas:~/rrddata$ /home/mike/bin/get*
+ OutsideTempSensor=28.B86392070000
+ RRDDataDirectory=/home/mike/rrddata/
+ RRDDataFile=outside_temp.rrd
++ cat /mnt/1wire/28.B86392070000/temperature
++ sed -e 's/ //g'
++ awk '{$1=$1 + 0.005;printf "%.2f", $1}'
+ outsidetemp=0.13
+ rrdtool update /home/mike/rrddata/outside_temp.rrd N:0.13
+ echo 0.13
0.13
mike@mike-elvanas:~/rrddata$ rrdtool lastupdate out*
outsidetemp
1707940605: 0.13
mike@mike-elvanas:~/rrddata$ rrdtool info out*
filename = "outside_temp.rrd"
rrd_version = "0003"
step = 150
last_update = 1707940605
header_size = 2872
ds[outsidetemp].index = 0
ds[outsidetemp].type = "GAUGE"
ds[outsidetemp].minimal_heartbeat = 300
ds[outsidetemp].min = -5.0000000000e+01
ds[outsidetemp].max = 6.0000000000e+01
ds[outsidetemp].last_ds = "0.13"
ds[outsidetemp].value = 5.6682233400e+00
ds[outsidetemp].unknown_sec = 62
Kod: Markera allt
mike@mike-elvanas:~/rrddata$ rrdtool lastupdate out*
outsidetemp
1707940922: 0,01
mike@mike-elvanas:~/rrddata$ rrdtool lastupdate out*
outsidetemp
1707942002: 0,01
mike@mike-elvanas:~/rrddata$ rrdtool lastupdate out*
outsidetemp
1707942361: 0,01