aboutsummaryrefslogtreecommitdiffstats
path: root/bat2nodes.py
diff options
context:
space:
mode:
Diffstat (limited to 'bat2nodes.py')
-rwxr-xr-xbat2nodes.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/bat2nodes.py b/bat2nodes.py
index 6047d95..1e55b3e 100755
--- a/bat2nodes.py
+++ b/bat2nodes.py
@@ -4,10 +4,11 @@ import json
import fileinput
import argparse
import os
+import time
from batman import batman
from alfred import alfred
-from rrd import rrd
+from rrddb import rrd
from nodedb import NodeDB
from d3mapbuilder import D3MapBuilder
@@ -30,9 +31,6 @@ parser.add_argument('-a', '--aliases',
parser.add_argument('-m', '--mesh', action='append',
help='batman mesh interface')
-parser.add_argument('-o', '--obscure', action='store_true',
- help='obscure client macs')
-
parser.add_argument('-A', '--alfred', action='store_true',
help='retrieve aliases from alfred')
@@ -43,7 +41,8 @@ args = parser.parse_args()
options = vars(args)
-db = NodeDB()
+db = NodeDB(int(time.time()))
+
if options['mesh']:
for mesh_interface in options['mesh']:
bm = batman(mesh_interface)
@@ -64,10 +63,12 @@ if options['alfred']:
af = alfred()
db.import_aliases(af.aliases())
-db.count_clients()
+db.load_state("state.json")
+
+# remove nodes that have been offline for more than 30 days
+db.prune_offline(time.time() - 30*86400)
-if options['obscure']:
- db.obscure_clients()
+db.dump_state("state.json")
scriptdir = os.path.dirname(os.path.realpath(__file__))