Update RRDs of offline nodes, ignore key errors

dev
Jan-Philipp Litza 2015-09-08 21:34:41 +02:00
parent dc8171dbd6
commit ddcf8fbead
1 changed files with 6 additions and 3 deletions

View File

@ -31,11 +31,14 @@ class RRD(object):
node_count = 0 node_count = 0
client_count = 0 client_count = 0
for node in nodes: for node in nodes:
try:
if node['flags']['online']: if node['flags']['online']:
node_count += 1 node_count += 1
client_count += node['statistics']['clients'] client_count += node['statistics']['clients']
rrd = NodeRRD(os.path.join(self.dbPath, node['nodeinfo']['node_id'] + '.rrd'), node) rrd = NodeRRD(os.path.join(self.dbPath, node['nodeinfo']['node_id'] + '.rrd'), node)
rrd.update() rrd.update()
except KeyError:
pass
self.globalDb.update(node_count, client_count) self.globalDb.update(node_count, client_count)
def update_images(self): def update_images(self):