Last active
December 20, 2015 15:08
-
-
Save glisha/6151688 to your computer and use it in GitHub Desktop.
ds1621 сензори врзани на Raspberry PI. Графирање со rrdtool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#*/15 * * * * /root/ds1621/8chasa-grafik.sh > /dev/null 2>&1 | |
rrdtool graph /usr/share/nginx/html/temperatura_4f-8chasa.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 4f последните 8 часа" \ | |
--slope-mode \ | |
--end now --start end-8h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE:step=60 \ | |
AREA:temp_4f#FF0000 \ | |
LINE1:temp_4f#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_48-8chasa.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 48 последните 8 часа" \ | |
--slope-mode \ | |
--end now --start end-8h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE \ | |
AREA:temp_48#FF0000 \ | |
LINE1:temp_48#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_zaedno-8chasa.png \ | |
--vertical-label "°C" \ | |
--title "Температура последните 8 часа" \ | |
--slope-mode \ | |
--end now --start end-8h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE \ | |
LINE1:temp_48#FF0000:"Сензор 48\l" \ | |
TEXTALIGN:center \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"\t\tПоследна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf\n" \ | |
LINE1:temp_4f#00FF00:"Сензор 4f\l" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"\t\tПослeдна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## | |
# Направи ја .rrd базата | |
# rrdtool create /root/ds1621/temp.rrd --start now-1h --step 120 DS:48:GAUGE:600:-10:120 DS:4f:GAUGE:600:-10:120 RRA:AVERAGE:0.5:1:576 RRA:AVERAGE:0.5:6:672 RRA:AVERAGE:0.5:24:732 RRA:AVERAGE:0.5:144:1460 | |
# | |
# На boot да се вчита i2c и ds1621 | |
# echo -e "i2c-dev\nds1621" > /etc/modules-load.d/i2c-ds1621.conf | |
# | |
# Во cron: | |
# */5 * * * * /root/ds1621/azhuriraj_temp.sh > /dev/null 2>&1 | |
# | |
temp_48=`sensors| grep -A 2 "ds1621-i2c-0-48"| grep -i temp| sed -re "s/.* \+([0-9]+.[0-9]).*/\1/g"` | |
temp_4f=`sensors| grep -A 2 "ds1621-i2c-0-4f"| grep -i temp| sed -re "s/.* \+([0-9]+.[0-9]).*/\1/g"` | |
rrdtool update /root/ds1621/temp.rrd --template 48:4f N:$temp_48:$temp_4f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#*/15 * * * * /root/ds1621/dneven-grafik.sh > /dev/null 2>&1 | |
rrdtool graph /usr/share/nginx/html/temperatura_4f-den.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 4f последните 24 часа" \ | |
--slope-mode \ | |
--end now --start end-24h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE \ | |
AREA:temp_4f#FF0000 \ | |
LINE1:temp_4f#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_48-den.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 48 последните 24 часа" \ | |
--slope-mode \ | |
--end now --start end-24h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE \ | |
AREA:temp_48#FF0000 \ | |
LINE1:temp_48#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_zaedno-den.png \ | |
--vertical-label "°C" \ | |
--title "Температура последните 24 часа" \ | |
--slope-mode \ | |
--end now --start end-24h \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE \ | |
LINE1:temp_48#FF0000:"Сензор 48\l" \ | |
TEXTALIGN:center \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"\t\tПоследна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf\n" \ | |
LINE1:temp_4f#00FF00:"Сензор 4f\l" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"\t\tПослeдна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="mk-MK"> | |
<head> | |
<meta http-equiv="refresh" content="300"> | |
<meta charset="UTF-8" /> | |
</head> | |
<body> | |
<ul> | |
<li><a href="#zaedno">Заедно на ист график</a></li> | |
<li><a href="#4f">Сензор 4f</a></li> | |
<li><a href="#48">Сензор 48</a></li> | |
</ul> | |
<hr /> | |
<a name="zaedno"></a> | |
<h3>Заедно двата сензори на ист график</h3> | |
<p><img src="temperatura_zaedno-8chasa.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_zaedno-den.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_zaedno-sedmica.png" width="597px" height="298px" /></p> | |
<hr /> | |
<a name="#4f"></a> | |
<h3>Сензор 4f</h3> | |
<p><img src="temperatura_4f-8chasa.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_4f-den.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_4f-sedmica.png" width="597px" height="298px" /></p> | |
<hr /> | |
<a name="#48"></a> | |
<h3>Сензор 48</h3> | |
<p><img src="temperatura_48-8chasa.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_48-den.png" width="597px" height="298px" /></p> | |
<p><img src="temperatura_48-sedmica.png" width="597px" height="298px" /></p> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
##59 * * * * /root/ds1621/sedmichen-grafik.sh > /dev/null 2>&1 | |
rrdtool graph /usr/share/nginx/html/temperatura_4f-sedmica.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 4f последните 7 денови" \ | |
--slope-mode \ | |
--end now --start end-7d \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE:step=60 \ | |
AREA:temp_4f#FF0000 \ | |
LINE1:temp_4f#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_48-sedmica.png \ | |
--vertical-label "°C" \ | |
--title "Температура сензор 48 последните 7 денови" \ | |
--slope-mode \ | |
--end now --start end-7d \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE:step=60 \ | |
AREA:temp_48#FF0000 \ | |
LINE1:temp_48#000000 \ | |
COMMENT:" \n" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"Последна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf" | |
rrdtool graph /usr/share/nginx/html/temperatura_zaedno-sedmica.png \ | |
--vertical-label "°C" \ | |
--title "Температура последните 7 денови" \ | |
--slope-mode \ | |
--end now --start end-7d \ | |
--width 500 --height 200 \ | |
--watermark "`date`" \ | |
DEF:temp_48=/root/ds1621/temp.rrd:48:AVERAGE:step=60 \ | |
DEF:temp_4f=/root/ds1621/temp.rrd:4f:AVERAGE:step=60 \ | |
LINE1:temp_48#FF0000:"Сензор 48\l" \ | |
TEXTALIGN:center \ | |
TEXTALIGN:center \ | |
GPRINT:temp_48:LAST:"\t\tПоследна\: %5.2lf" \ | |
GPRINT:temp_48:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_48:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_48:AVERAGE:"Просечна\: %5.2lf\n" \ | |
LINE1:temp_4f#00FF00:"Сензор 4f\l" \ | |
TEXTALIGN:center \ | |
GPRINT:temp_4f:LAST:"\t\tПослeдна\: %5.2lf" \ | |
GPRINT:temp_4f:MIN:"Минимум\: %5.2lf" \ | |
GPRINT:temp_4f:MAX:"Максимум\: %5.2lf" \ | |
GPRINT:temp_4f:AVERAGE:"Просечна\: %5.2lf\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment