summaryrefslogtreecommitdiff
path: root/examples/RRD
diff options
context:
space:
mode:
Diffstat (limited to 'examples/RRD')
-rwxr-xr-xexamples/RRD/add_measurement_to_rrd5
-rwxr-xr-xexamples/RRD/draw_graph_from_rrd5
-rwxr-xr-xexamples/RRD/make_rrd3
-rw-r--r--examples/RRD/rrd.txt34
4 files changed, 47 insertions, 0 deletions
diff --git a/examples/RRD/add_measurement_to_rrd b/examples/RRD/add_measurement_to_rrd
new file mode 100755
index 0000000..c261043
--- /dev/null
+++ b/examples/RRD/add_measurement_to_rrd
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+MEASURED_TEMPERATURE=`clewarecontrol -rt 2> /dev/null | grep 'Temperature' | awk '{ print $2; }'`
+
+rrdtool update cleware_data.rrd N:$MEASURED_TEMPERATURE
diff --git a/examples/RRD/draw_graph_from_rrd b/examples/RRD/draw_graph_from_rrd
new file mode 100755
index 0000000..64cba57
--- /dev/null
+++ b/examples/RRD/draw_graph_from_rrd
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+rrdtool graph graph.png -a PNG \
+ DEF:temp=cleware_data.rrd:temperature:AVERAGE \
+ LINE1:temp#FF0000:"temperatures"
diff --git a/examples/RRD/make_rrd b/examples/RRD/make_rrd
new file mode 100755
index 0000000..ef244c3
--- /dev/null
+++ b/examples/RRD/make_rrd
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+rrdtool create cleware_data.rrd DS:temperature:GAUGE:300:U:U RRA:AVERAGE:0:1:105192
diff --git a/examples/RRD/rrd.txt b/examples/RRD/rrd.txt
new file mode 100644
index 0000000..5e30e31
--- /dev/null
+++ b/examples/RRD/rrd.txt
@@ -0,0 +1,34 @@
+Creating temperature graphs
+---------------------------
+
+Files:
+ - rrd.txt
+ - make_rrdr
+ - add_measurement_to_rrd
+ - draw_graph_from_rrd
+
+1. First one executes the 'make_rrd' script (ONCE!) to initialize the
+ database in which measurements are stored.
+
+2. Then, from cron for example one executes every 5 minutes the
+ 'add_measurement_to_rrd' script. Make sure 'clewarecontrol' is in
+ the path.
+
+3. Every time you would like to have the graphs updated (e.g. you want
+ to see what was measured), invoke the draw_graph_from_rrd script.
+
+4. After invoking the draw-script, you'll find a 'graph.png'-file in
+ the current directory which can be viewed with your favorite
+ picture viewer.
+
+
+These scripts can be easily adapted to measure humidity as well. This
+is left to an excercise for the reader.
+One hint for the humidity sensor: when the power went off of the
+humidity sensor one needs to start it first before the sensor will
+start measuring. Use 'clewarecontrol -ag' for that.
+
+
+
+For any question related to Cleware devices under Linux, feel free to
+contact me at the following e-mail address: folkert@vanheusden.com