Created
April 23, 2016 06:03
-
-
Save jdevoo/03358bc603cc5eb8a51df9aca2143df4 to your computer and use it in GitHub Desktop.
plotting sensor data with RRDtool
This file contains 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
# expected format | |
#{ | |
# "location": "92882", | |
# "Air": 166, | |
# "Carbon-Monoxide": 208, | |
# "Hexane": 227, | |
# "Methane": 253, | |
# "Benzine": 245, | |
# "Alcohol": 256, | |
# "LPG": 274 | |
#} | |
rrdtool create env.rrd \ | |
--step 60 \ | |
DS:Air:GAUGE:90:100:200 \ | |
DS:CarbonMonoxide:GAUGE:90:100:300 \ | |
DS:Hexane:GAUGE:90:100:300 \ | |
DS:Methane:GAUGE:90:100:300 \ | |
DS:Benzine:GAUGE:90:100:300 \ | |
DS:Alcohol:GAUGE:90:100:300 \ | |
DS:LPG:GAUGE:90:100:300 \ | |
RRA:MAX:0.5:1:2016 |
This file contains 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
# read mat's sensor data | |
# expected format | |
#{ | |
# "location": "92882", | |
# "Air": 166, | |
# "Carbon-Monoxide": 208, | |
# "Hexane": 227, | |
# "Methane": 253, | |
# "Benzine": 245, | |
# "Alcohol": 256, | |
# "LPG": 274 | |
#} | |
# join all numerical values of last 7 rows | |
wget -q -O - http://75.83.160.111:8085/env/ | grep -o '[0-9]\+' | tail -n 7 | paste -sd ':' |
This file contains 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
rrdtool graph /var/www/env.png \ | |
-w 785 -h 240 -a PNG \ | |
--start -86400 --end now \ | |
--vertical-label "value" \ | |
DEF:Air=/home/jdevoo/env.rrd:Air:MAX \ | |
DEF:CarbonMonoxide=/home/jdevoo/env.rrd:CarbonMonoxide:MAX \ | |
DEF:Hexane=/home/jdevoo/env.rrd:Hexane:MAX \ | |
DEF:Methane=/home/jdevoo/env.rrd:Methane:MAX \ | |
DEF:Benzine=/home/jdevoo/env.rrd:Benzine:MAX \ | |
DEF:Alcohol=/home/jdevoo/env.rrd:Alcohol:MAX \ | |
DEF:LPG=/home/jdevoo/env.rrd:LPG:MAX \ | |
LINE1:Air#ff0000:"Air" \ | |
LINE2:CarbonMonoxide#00ff00:"Carbon-Monoxide" \ | |
LINE1:Hexane#0000ff:"Hexane" \ | |
LINE1:Methane#0fa000:"Methane" \ | |
LINE1:Benzine#00fa00:"Benzine" \ | |
LINE1:Alcohol#000fa0:"Alcohol" \ | |
LINE1:LPG#f000f0:"LPG" \ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment