aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Schneider <nils@nilsschneider.net>2014-08-17 19:10:19 +0200
committerNils Schneider <nils@nilsschneider.net>2014-08-17 19:10:19 +0200
commit0d71de7091711ec4838c797c17c65b23454078c3 (patch)
tree9043c264f3a98446a8952713cb57a2d6201ae394
parent2dfd11189dd419ab09cb0630accab78b37edefde (diff)
fix rrd
-rw-r--r--NodeRRD.py2
-rwxr-xr-xbatman.py2
-rw-r--r--nodedb.py4
-rwxr-xr-xrrd.py18
4 files changed, 2 insertions, 24 deletions
diff --git a/NodeRRD.py b/NodeRRD.py
index f53cad6..6fa32f3 100644
--- a/NodeRRD.py
+++ b/NodeRRD.py
@@ -30,7 +30,7 @@ class NodeRRD(RRD):
return os.path.basename(self.filename).rsplit('.', 2)[0] + ".png"
def update(self):
- super().update({'upstate': 1, 'clients': self.node.clients})
+ super().update({'upstate': 1, 'clients': self.node.clientcount})
def graph(self, directory, timeframe):
"""
diff --git a/batman.py b/batman.py
index c9b3db6..583d962 100755
--- a/batman.py
+++ b/batman.py
@@ -31,8 +31,6 @@ class batman:
output = subprocess.check_output(["batctl","-m",self.mesh_interface,"vd","json","-n"])
lines = output.splitlines()
vds = self.vis_data_helper(lines)
- for vd in vds:
- vd['legacy'] = True
return vds
def vis_data_batadv_vis(self):
diff --git a/nodedb.py b/nodedb.py
index 6b3d503..b41f917 100644
--- a/nodedb.py
+++ b/nodedb.py
@@ -91,8 +91,6 @@ class NodeDB:
node = Node()
node.lastseen = self.time
node.flags['online'] = True
- if 'legacy' in x:
- node.flags['legacy'] = True
self._nodes.append(node)
node.add_mac(x['of'])
@@ -110,8 +108,6 @@ class NodeDB:
node = Node()
node.lastseen = self.time
node.flags['online'] = True
- if 'legacy' in x:
- node.flags['legacy'] = True
node.add_mac(x['router'])
self._nodes.append(node)
diff --git a/rrd.py b/rrd.py
index 5c3330d..2a03026 100755
--- a/rrd.py
+++ b/rrd.py
@@ -28,23 +28,7 @@ class rrd:
def update_database(self,db):
nodes = {}
- clientCount = 0
- for node in db.get_nodes():
- if node.flags['online']:
- if not node.flags['client']:
- nodes[node.id] = node
- node.clients = 0;
- if 'legacy' in node.flags and node.flags['legacy']:
- clientCount -= 1
- else:
- clientCount += 1
- for link in db.get_links():
- source = link.source.interface
- target = link.target.interface
- if source in nodes and not target in nodes:
- nodes[source].clients += 1
- elif target in nodes and not source in nodes:
- nodes[target].clients += 1
+ clientCount = sum(map(lambda d: d.clientcount, db.get_nodes()))
self.globalDb.update(len(nodes), clientCount)
for node in nodes.values():