summaryrefslogtreecommitdiff
path: root/envmon/rrdlog.py
diff options
context:
space:
mode:
authorChristian Franke <nobody@nowhere.ws>2013-06-20 19:25:15 +0200
committerChristian Franke <nobody@nowhere.ws>2013-06-20 19:25:31 +0200
commit9191312aac429e745388029ba57a29f015378541 (patch)
tree43fbbf740d0e2a0a231accb2db8e5f9df3af6c8c /envmon/rrdlog.py
parent0ab0cbbda438fd30f24273f1db99d76746108a75 (diff)
Add envmon code
Diffstat (limited to 'envmon/rrdlog.py')
-rw-r--r--envmon/rrdlog.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/envmon/rrdlog.py b/envmon/rrdlog.py
new file mode 100644
index 0000000..4dd4708
--- /dev/null
+++ b/envmon/rrdlog.py
@@ -0,0 +1,13 @@
+import rrdtool
+import os
+
+class TempLog(object):
+ def __init__(self, name):
+ self.name = name
+ if not os.path.exists(self.name):
+ rrdtool.create(self.name, 'DS:temperature:GAUGE:600:U:U',
+ 'RRA:AVERAGE:0.5:1:17280', # Keep 5min snapshots for the last two months
+ 'RRA:AVERAGE:0.5:12:87660', # Keep 1h averages for 10 years (as if...)
+ )
+ def update(self, temperature):
+ rrdtool.update(self.name, 'N:%f' % temperature)