comparison web/log.py @ 431:ae12b30352f0

extra logging
author Matt Johnston <matt@ucc.asn.au>
date Sat, 13 Oct 2012 20:22:50 +0800
parents eb685e1afcbb
children d36fe81077cc
comparison
equal deleted inserted replaced
427:7c2efec9cd51 431:ae12b30352f0
76 graph_args.append('DEF:%(vname)s=%(rrdfile)s:temp:AVERAGE:step=3600' % locals()) 76 graph_args.append('DEF:%(vname)s=%(rrdfile)s:temp:AVERAGE:step=3600' % locals())
77 unit = 'V' 77 unit = 'V'
78 elif 'fridge_on' in sensor: 78 elif 'fridge_on' in sensor:
79 vname = 'fridge_on' 79 vname = 'fridge_on'
80 graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:LAST' % locals()) 80 graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:LAST' % locals())
81 graph_args.append('CDEF:%(vname)s=raw%(vname)s,3,+' % locals()) 81 graph_args.append('CDEF:%(vname)s=raw%(vname)s,-0.2,*,3,+' % locals())
82 else: 82 else:
83 vname = 'temp%d' % n 83 vname = 'temp%d' % n
84 graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:AVERAGE' % locals()) 84 graph_args.append('DEF:raw%(vname)s=%(rrdfile)s:temp:AVERAGE' % locals())
85 # limit max temp to 50 85 # limit max temp to 50
86 graph_args.append('CDEF:%(vname)s=raw%(vname)s,35,GT,UNKN,raw%(vname)s,0.1,*,2,+,IF' % locals()) 86 graph_args.append('CDEF:%(vname)s=raw%(vname)s,35,GT,UNKN,raw%(vname)s,0.1,*,2,+,IF' % locals())
214 214
215 entries = dict(l.split('=', 1) for l in lines) 215 entries = dict(l.split('=', 1) for l in lines)
216 if len(entries) != len(lines): 216 if len(entries) != len(lines):
217 raise Exception("Keys are not unique") 217 raise Exception("Keys are not unique")
218 218
219 if 'sensors' not in entries:
220 # only debug info, it's been recorded
221 return
222
219 num_sensors = int(entries['sensors']) 223 num_sensors = int(entries['sensors'])
220 num_measurements = int(entries['measurements']) 224 num_measurements = int(entries['measurements'])
221 225
222 sensors = [entries['sensor_id%d' % n] for n in xrange(num_sensors)] 226 sensors = [entries['sensor_id%d' % n] for n in xrange(num_sensors)]
223 227