[svn r21] added rrd conversion tool, corrected step size in rrd trunk svn.21

Fri, 19 Mar 2010 19:19:40 +0100

author
mbayer
date
Fri, 19 Mar 2010 19:19:40 +0100
branch
trunk
changeset 18
d54571dc6d31
parent 17
ef30d3abf610
child 19
373b2f8911b2

[svn r21] added rrd conversion tool, corrected step size in rrd

CHANGELOG file | annotate | diff | comparison | revisions
shutdown.sh file | annotate | diff | comparison | revisions
tools.py file | annotate | diff | comparison | revisions
tools/rrd_convert.py file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CHANGELOG	Fri Mar 19 19:19:40 2010 +0100
@@ -0,0 +1,9 @@
+2010 03 19:
+    i noticed that the generated RRD has a 300 sec step size.
+    You easily can convert your existing RRD to the step size of 10 secs by doing the following (at your own risk):
+
+    # STOP THE CURRENT RUNNING victron.py, then do the following in trunk:
+    rrdtool dump ups-values.rrd tools/input.xml
+    cd tools; python rrd_convert.py; cd ..
+    mv ups-values.rrd ups-values.rrd.backup
+    rrdtool restore tools/output.xml ups-values.rrd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/shutdown.sh	Fri Mar 19 19:19:40 2010 +0100
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# check if we got parameter "now", then secure shutdown the system
+if [ "$1" = "now" ]; then
+    echo "UPS System Shutdown initiated...."
+    # shutdown and halt the host system
+    shutdown -h now
+else
+    echo "NO SHUTDOWN, GIVE CORRECT PARAMETER"
+fi
\ No newline at end of file
--- a/tools.py	Fri Mar 19 18:10:52 2010 +0100
+++ b/tools.py	Fri Mar 19 19:19:40 2010 +0100
@@ -15,7 +15,7 @@
         try:
             r = os.system("rrdtool create "+filename+" \
                     --start=1000277700 \
-                    --step=10
+                    --step=10 \
                     DS:Vin:GAUGE:10:U:U \
                     DS:Pin:GAUGE:10:U:U \
                     DS:Fin:GAUGE:10:U:U \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/rrd_convert.py	Fri Mar 19 19:19:40 2010 +0100
@@ -0,0 +1,28 @@
+# convert RRD from 300 sec resolution to 10 sec resolution
+
+i = open("input.xml")
+o = open("output.xml","w")
+
+db_start = "<database>"
+db_end = "</database>"
+steplabel = "<step>300</step>"
+
+database = False
+
+for line in i:
+    if steplabel in line:
+	o.write("<step>10</step>\n")
+	continue
+    if db_start in line:
+	database = True
+	o.write(line)
+	continue
+    if db_end in line:
+	database = False
+	o.write(line)
+	continue
+    if database==False:
+	o.write(line)
+    else:
+	for cnt in range(1,30):
+	    o.write(line)
\ No newline at end of file

mercurial