From b570d8956f65e5e824e1065aebb8f1a499ee870d Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 22 Sep 2014 23:34:21 +0200 Subject: [PATCH] global rrd: Count online nodes instead of nodes in state --- rrddb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rrddb.py b/rrddb.py index 6f48913..36e4682 100755 --- a/rrddb.py +++ b/rrddb.py @@ -30,7 +30,8 @@ class rrd: nodes = db.get_nodes() clientCount = sum(map(lambda d: d.clientcount, nodes)) - self.globalDb.update(len(nodes), clientCount) + curtime = time.time() - 60 + self.globalDb.update(len(list(filter(lambda x: x.lastseen >= curtime, nodes))), clientCount) for node in nodes: rrd = NodeRRD( os.path.join(self.dbPath, str(node.id).replace(':', '') + '.rrd'),