summaryrefslogtreecommitdiff
path: root/envmon/onewire2rrd.py
blob: d3d2927933a13751f98378f18ae8e7a2147b6b75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/python

import time
import sys

import onewire
import rrdlog

while True:
	for sensor in onewire.sensors():
		try:
			rrdlog.TempLog('onewire-temp-%s.rrd' % sensor).update(onewire.sensor(sensor).temperature)
		except Exception:
			print >>sys.stderr, "On %s: Could not retrieve temperature for '%s':" % (
				time.strftime('%a, %d %b %Y %T %z'), sensor)
			sys.excepthook(*sys.exc_info())
			print >>sys.stderr, '========================================'
	time.sleep(300-len(onewire.sensors()))