From 6d7a24980ba49e6b05dba139af76c09147fcf967 Mon Sep 17 00:00:00 2001 From: Ruben Barkow Date: Thu, 22 May 2014 23:11:01 +0200 Subject: [PATCH 01/39] Update README.md typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3921163..a9ce569 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ gluon-alfred-vis ================ Lists all nodes in Freifunk by analysing alfred.json -there has to be a file `alfred.json` in the root folder of this krepository +there has to be a file `alfred.json` in the root folder of this repository From a15d23c2e5519d81ed8c3e913e22d28ce665153f Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 5 Jun 2014 23:58:39 +0200 Subject: [PATCH 02/39] Added GEO coordinates --- alfred.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/alfred.html b/alfred.html index bc7547a..40503d8 100644 --- a/alfred.html +++ b/alfred.html @@ -23,7 +23,9 @@ firmware: val['software']['firmware']['release'], model: val['hardware']['model'], autoupdate: (val.software.autoupdater.enabled?val.software.autoupdater.branch:''), - contact: ('owner' in val?val['owner']['contact']:'') + contact: ('owner' in val?val['owner']['contact']:''), + longitude: ('location' in val?val['location']['longitude']:''), + latitude: ('location' in val?val['location']['latitude']:'') }); } catch (e) {}; }); @@ -145,6 +147,8 @@ +''+arr[e].model+'' +''+arr[e].autoupdate+'' +''+arr[e].contact+'' + +''+arr[e].longitude+'' + +''+arr[e].latitude+'' +''; } $('#results').html(html); @@ -175,6 +179,8 @@

Knotenliste

model autoupdate contact + long + lat From 16e1de7e574601337a0fc8e181449fb9954df265 Mon Sep 17 00:00:00 2001 From: ruben Date: Fri, 6 Jun 2014 00:58:19 +0200 Subject: [PATCH 03/39] list, graph and map linked to http://freifunk.in-kiel.de/ffmap/ --- alfred.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/alfred.html b/alfred.html index 40503d8..90a1df5 100644 --- a/alfred.html +++ b/alfred.html @@ -159,9 +159,9 @@

kiel.freifunk.net

From 86834080729400be4495cbde57b2419b47a1e987 Mon Sep 17 00:00:00 2001 From: ruben Date: Tue, 22 Jul 2014 18:54:26 +0200 Subject: [PATCH 04/39] show all available info for each node --- alfred.html | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/alfred.html b/alfred.html index 90a1df5..87c3fa0 100644 --- a/alfred.html +++ b/alfred.html @@ -9,13 +9,39 @@ - - + + - - -
-

kiel.freifunk.net

- -
-
-

Knotenliste

-
-
- - - - - - - - - - - - - - - - - - - - - - - - -
hostnameuptimeofflinetx (mb)rx (mb)firmwaremodelmacautoupdatecontactlonglatautoupdateloadavgmem freemore
this page needs JavaScript to work
- + if (asc) return ret; + else return -ret; + }); + showResults(); + } + var all=Object; + function showResults () { + var html = ''; + for (var e in arr) { + offllineclass=(arr[e].offline==1?' class="offline"':'') + html += '' + +''+arr[e].hostname+'' + +''+Math.floor(arr[e].uptime/3600)+'h' + +''+(arr[e].offline?"offline":'')+'' + +''+Math.floor(arr[e].tx/1048576)+'' + +''+Math.floor(arr[e].rx/1048576)+'' + +''+arr[e].firmware+'' + +''+arr[e].model+'' + +''+arr[e].mac+'' + +''+arr[e].autoupdate+'' + +''+arr[e].contact+'' + +''+arr[e].longitude+'' + +''+arr[e].latitude+'' + +''+arr[e].autoupdate+'' + +''+arr[e].loadavg+'' + +''+(arr[e].mem*100).toFixed(2)+'%' + +''; + for (var p in arr[e]) { + if (arr[e].hasOwnProperty(p) && !inArray(p,cols)) { + if(p!="pos") html += p + ':' + arr[e][p] + '
'; + } + } + html +='' + +''; + } + $('#results').html(html); + } + + + +
+

kiel.freifunk.net

+ +
+
+

Knotenliste

+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
hostnameuptimeofflinetx (mb)rx (mb)firmwaremodelmacautoupdatecontactlonglatautoupdateloadavgmem freemore
this page needs JavaScript to work
+ From 578f1ba9ca0167c2b2a22fef5b5916bf732ad514 Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 31 Jul 2014 18:29:07 +0200 Subject: [PATCH 21/39] * added date of latest check * added nodecount online, offline and total * added link to jsonfile in node logs --- bin/alfred-log.py | 10 ++++- bin/update-json.sh | 8 ++++ www/alfred.html | 102 ++++++++++++++++++++++++++------------------- 3 files changed, 76 insertions(+), 44 deletions(-) diff --git a/bin/alfred-log.py b/bin/alfred-log.py index 9008ccd..7d2da95 100755 --- a/bin/alfred-log.py +++ b/bin/alfred-log.py @@ -2,10 +2,16 @@ # -*- coding: UTF-8 -*- """ +This script splits all nodes in single files under logs/nodes and creates an alfred_offline.json file + Syntax: python alfred-log.py < alfred.json """ -import json, sys, os +import json, sys, os, datetime, time + +# timestamp to be added in alfred_offline.json +timestamp = time.time() +h_datetime = datetime.datetime.fromtimestamp(timestamp).strftime('%d.%m %H:%M:%S') try: nodes=json.load(sys.stdin) @@ -33,5 +39,5 @@ # offline nodes (on): offline=open('alfred_offline.json', 'w') -offline.write('{%s}' % ",".join(ons)) +offline.write('{"additional_data": {"datetime": "%s", "timestamp": "%s"}, %s}' % (h_datetime, timestamp, ",".join(ons))) offline.close() diff --git a/bin/update-json.sh b/bin/update-json.sh index 2358ed2..1814060 100755 --- a/bin/update-json.sh +++ b/bin/update-json.sh @@ -1,5 +1,8 @@ #!/bin/bash +# This script downloads the latest alfred.json, creates logs by date in the www folder of your allpplication under logs/ +# and calls alfred-log.py that splits all nodes in single files under logs/nodes and creates an alfred_offline.json file + BINPATH="$1" WWWPATH="$2" URL="$3" @@ -17,8 +20,13 @@ fi cd "${WWWPATH}" +# get the actual json file from $URL curl -o alfred.json "$URL" mkdir -p logs/nodes + +# copy the new file to a backupped version by date for possible analysation use later cp alfred.json logs/alfred_$(date +%y%m%d-%H%M%S).json + +# call alfred-log.py to split all single nodes under logs/nodes ${BINPATH}/alfred-log.py < alfred.json diff --git a/www/alfred.html b/www/alfred.html index b3187cb..1006ff8 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -19,6 +19,10 @@ return false; } + // each single node has its own json logged here: + path_to_node_json='http://freifunk.discovibration.de/gluon-alfred-vis/www/logs/nodes/'; + + // all column heads: var cols = [ "hostname", "uptime", @@ -38,56 +42,64 @@ ]; function fill_arr(key,val,offline){ - var n = []; - n.offline=offline; - try { n.hostname=val['hostname'] ; } catch (e) {console.log('no')}; - try { n.fastd_enabled= val['software']['fastd']['enabled']?1:0 ; } catch (e) {}; - try { n.address= val['network']['addresses'][0] ; } catch (e) {}; - if(val['statistics'] == null) { - n.uptime=0; - n.tx=0; - n.rx=0; - n.idletime= 0; - n.processes_running= 0; - n.loadavg=0; - n.mem=0; - } else { - try { n.uptime=parseFloat(val['statistics']['uptime']) ; } catch (e) {}; - try { n.tx= parseFloat(val['statistics']['traffic']['tx']['bytes']) ; } catch (e) {}; - try { n.rx= parseFloat(val['statistics']['traffic']['rx']['bytes']) ; } catch (e) {}; - try { n.idletime= Math.floor(parseFloat(val['statistics']['idletime'])/3600)+'h' ; } catch (e) {}; - try { n.processes_running= val['statistics']['processes']['running'] ; } catch (e) {}; - try { n.loadavg= parseFloat(val['statistics'] != null?val['statistics']['loadavg']:0) ; } catch (e) {}; - try { - n.mem= parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['free']:1.0) / parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['total']:0); - } catch (e) {}; + if(key=="additional_data"){ + // added by alfred-log.py in alfred_offline.json + $('#headline').append(" ("+val['datetime']+")") + }else{ + var n = []; + n.offline=offline; + try { n.hostname=val['hostname'] ; } catch (e) {console.log('no')}; + try { n.fastd_enabled= val['software']['fastd']['enabled']?1:0 ; } catch (e) {}; + try { n.address= val['network']['addresses'][0] ; } catch (e) {}; + if(val['statistics'] == null) { + n.uptime=0; + n.tx=0; + n.rx=0; + n.idletime= 0; + n.processes_running= 0; + n.loadavg=0; + n.mem=0; + } else { + try { n.uptime=parseFloat(val['statistics']['uptime']) ; } catch (e) {}; + try { n.tx= parseFloat(val['statistics']['traffic']['tx']['bytes']) ; } catch (e) {}; + try { n.rx= parseFloat(val['statistics']['traffic']['rx']['bytes']) ; } catch (e) {}; + try { n.idletime= Math.floor(parseFloat(val['statistics']['idletime'])/3600)+'h' ; } catch (e) {}; + try { n.processes_running= val['statistics']['processes']['running'] ; } catch (e) {}; + try { n.loadavg= parseFloat(val['statistics'] != null?val['statistics']['loadavg']:0) ; } catch (e) {}; + try { + n.mem= parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['free']:1.0) / parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['total']:0); + } catch (e) {}; + } + try { n.firmware=val.software?val['software']['firmware']['release']:"-" ;} catch (e) {}; + try { n.model= val['hardware']?val['hardware']['model']:"-" ; } catch (e) {}; + try { n.autoupdate= val.software?(val.software.autoupdater.enabled?val.software.autoupdater.branch:''):'-' ; } catch (e) {}; + try { n.contact= ('owner' in val?val['owner']['contact']:'') ; } catch (e) {}; + try { n.longitude= ('location' in val?val['location']['longitude']:'') ; } catch (e) {}; + try { n.latitude= ('location' in val?val['location']['latitude']:'') ; } catch (e) {}; + try { n.mac= key ; } catch (e) {}; + arr.push(n); } - try { n.firmware= val['software']['firmware']['release'] ; } catch (e) {}; - try { n.model= val['hardware']['model'] ; } catch (e) {}; - try { n.autoupdate= (val.software.autoupdater.enabled?val.software.autoupdater.branch:'') ; } catch (e) {}; - try { n.contact= ('owner' in val?val['owner']['contact']:'') ; } catch (e) {}; - try { n.longitude= ('location' in val?val['location']['longitude']:'') ; } catch (e) {}; - try { n.latitude= ('location' in val?val['location']['latitude']:'') ; } catch (e) {}; - try { n.mac= key ; } catch (e) {}; - arr.push(n); } - - // forst add offline nodes + $(function() { + // first add offline nodes + var count_offline=0 $.getJSON( 'alfred_offline.json', function(data) { + count_offline--; // first element is "additional_data" $.each( data, function( key,val ) { fill_arr(key,val,1) + count_offline++ }); }); - }); - // add online nodes - $(function() { + // add online nodes + var count_online=0 $.getJSON( 'alfred.json', function(data) { $.each( data, function( key,val ) { fill_arr(key,val,0) + count_online++ }); - + $('#headings th').click(function() { var id = $(this).attr('id'); var asc = (!$(this).attr('asc')); // switch the order, true if not set @@ -102,10 +114,13 @@ }); sortResults('hostname', true); + + $('#headline').append(" "+count_online+" online"); + $('#headline').append(" "+count_offline+" offline"); }); - }); - + }); + function order(c) { if (/^\d$/.test(c)) return 0; @@ -220,11 +235,14 @@ if(p!="pos") html += p + ':' + arr[e][p] + '
'; } } - html +='' + html +='data' +''; } $('#results').html(html); + $('#results').append(arr.length+" Einträge"); + if(arr.length==0) alert("Fehler: kein Eintrag!"); } + @@ -237,7 +255,7 @@

kiel.freifunk.net
-

Knotenliste

+

Knotenliste

@@ -262,7 +280,7 @@

Knotenliste

- +
this page needs JavaScript to work
this page needs JavaScript to work. Data will be loaded...
From 672cbf99550d29f3a842f500983a52766cd71b55 Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 31 Jul 2014 23:57:44 +0200 Subject: [PATCH 22/39] add modified time for offline nodes --- www/alfred.html | 51 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 1006ff8..dd6bd46 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -10,7 +10,7 @@ @@ -255,7 +276,7 @@

kiel.freifunk.net
-

Knotenliste

+

Knotenliste

From aff0e29e292939848c02f266550794d8db364f7e Mon Sep 17 00:00:00 2001 From: ruben Date: Fri, 1 Aug 2014 00:25:43 +0200 Subject: [PATCH 23/39] sarted: show legacy nodes #5 --- www/alfred.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/www/alfred.html b/www/alfred.html index dd6bd46..a76b422 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -100,6 +100,20 @@ $('#subheadline').append(" "+count_offline+" offline"); }); + /*$.getJSON( 'nodes.json', function(data) { + count_offline--; // first element is "additional_data" + $.each( data.nodes, function( key,val ) { + val.hostname=val.name + key=val.id; + if(val.name=="") valname=val.id; + val.legacy=true + fill_arr(key,val,!val.flags.online) + count_offline++ + }); + $('#subheadline').append(" "+count_offline+" offline"); + }); + */ + // add online nodes var count_online=0 $.getJSON( 'alfred.json', function(data) { From 75fd0c5bec9144c49c8b37bf485d0f0bb555a5f1 Mon Sep 17 00:00:00 2001 From: ruben Date: Sat, 2 Aug 2014 14:58:38 +0200 Subject: [PATCH 24/39] reordered ajax calls --- www/alfred.html | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index a76b422..0ced689 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -99,21 +99,8 @@ }); $('#subheadline').append(" "+count_offline+" offline"); }); - - /*$.getJSON( 'nodes.json', function(data) { - count_offline--; // first element is "additional_data" - $.each( data.nodes, function( key,val ) { - val.hostname=val.name - key=val.id; - if(val.name=="") valname=val.id; - val.legacy=true - fill_arr(key,val,!val.flags.online) - count_offline++ - }); - $('#subheadline').append(" "+count_offline+" offline"); - }); - */ - + }); + $(function() { // add online nodes var count_online=0 $.getJSON( 'alfred.json', function(data) { @@ -141,7 +128,22 @@ }); }); - + /*$(function() { + $.getJSON( 'nodes.json', function(data) { + $.each( data.nodes, function( key,val ) { + val.hostname=val.name + key=val.id; + if(val.name=="") valname=val.id; + val.legacy=true + fill_arr(key,val,!val.flags.online) + if (val.flags.online) count_online++ + else count_offline++ + }); + $('#subheadline').append(" "+count_offline+" offline"); + }); + + });*/ + function order(c) { if (/^\d$/.test(c)) return 0; From 849017f832ea386defdd9be8892b1a56cdc5bd35 Mon Sep 17 00:00:00 2001 From: ruben Date: Mon, 4 Aug 2014 01:41:16 +0200 Subject: [PATCH 25/39] Added Legacy nodes.json to list closes #5 show legacy nodes https://github.com/ffnord/gluon-alfred-vis/issues/5 --- bin/update-json.sh | 20 ++++++--- www/alfred.html | 108 +++++++++++++++++++++++++-------------------- 2 files changed, 74 insertions(+), 54 deletions(-) diff --git a/bin/update-json.sh b/bin/update-json.sh index 1814060..215da63 100755 --- a/bin/update-json.sh +++ b/bin/update-json.sh @@ -1,20 +1,25 @@ #!/bin/bash -# This script downloads the latest alfred.json, creates logs by date in the www folder of your allpplication under logs/ +# This script downloads the latest alfred.json and optional legacy nodes.json, creates logs by date in the www folder of your allpplication under logs/ # and calls alfred-log.py that splits all nodes in single files under logs/nodes and creates an alfred_offline.json file BINPATH="$1" WWWPATH="$2" URL="$3" +LEGACY_URL="$4" # call this script regularly as a cron job to get the latest alfred.json file -if [ $# -ne 3 ] ; then - if [ "$1" -ne "--help" ]; then - echo "ERROR: wrong number of parameters "$# +if [ $# -ne 3 -a $# -ne 4 ] ; then + if [ "$1" != "--help" ]; then + echo "ERROR: wrong number of parameters" echo fi - echo "Syntax: $0 /path/to/bin /path/to/www http://freifunk.path/to/.../alfred.json" + echo "Syntax:" + echo "$0 /path/to/bin /path/to/www http://freifunk.path/to/.../alfred.json [http://freifunk.path/to/.../nodes.json]" + echo + echo "the fourth parameter for legacy nodes.json is optional" + echo exit 1 fi @@ -30,3 +35,8 @@ cp alfred.json logs/alfred_$(date +%y%m%d-%H%M%S).json # call alfred-log.py to split all single nodes under logs/nodes ${BINPATH}/alfred-log.py < alfred.json + +# optional download legacy nodes.json +if [ "$LEGACY_URL" != "" ]; then + curl -o nodes.json "$LEGACY_URL" +fi \ No newline at end of file diff --git a/www/alfred.html b/www/alfred.html index 0ced689..2fa0d9e 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -43,7 +43,6 @@ "contact", "longitude", "latitude", - "autoupdate", "loadavg", "mem" ]; @@ -83,66 +82,77 @@ try { n.contact= ('owner' in val?val['owner']['contact']:'') ; } catch (e) {}; try { n.longitude= ('location' in val?val['location']['longitude']:'') ; } catch (e) {}; try { n.latitude= ('location' in val?val['location']['latitude']:'') ; } catch (e) {}; + try { if(val['clientcount']) n.clientcount= val['clientcount'] ; } catch (e) {}; try { n.mac= key ; } catch (e) {}; arr.push(n); } } - + var step=0; + var count_offline=0 + var count_online=0 $(function() { // first add offline nodes - var count_offline=0 $.getJSON( 'alfred_offline.json', function(data) { count_offline--; // first element is "additional_data" $.each( data, function( key,val ) { fill_arr(key,val,1) count_offline++ - }); - $('#subheadline').append(" "+count_offline+" offline"); - }); - }); - $(function() { - // add online nodes - var count_online=0 - $.getJSON( 'alfred.json', function(data) { - $.each( data, function( key,val ) { - fill_arr(key,val,0) - count_online++ - }); - - $('#headings th').click(function() { - var id = $(this).attr('id'); - var asc = (!$(this).attr('asc')); // switch the order, true if not set - - // set asc="asc" when sorted in ascending order - $('#headings th').each(function() { - $(this).removeAttr('asc'); + }) + $('#subheadline').append("
Step "+(++step)+' alfred_offline.json'); + }).done(function(){ + // add online nodes + $.getJSON( 'alfred.json', function(data) { + $.each( data, function( key,val ) { + fill_arr(key,val,0) + count_online++ }); - if (asc) $(this).attr('asc', 'asc'); + + $('#subheadline').append("
Step "+(++step)+' alfred.json'); + }).done(function(){ + // get legacy nodes + $.getJSON( 'nodes.json', function(data) { + $.each( data.nodes, function( key,val ) { + if(!val.flags.client && !val.firmware){ + val.hostname=val.name + key=val.id; + if(val.name=="") val.hostname=val.id; + val.software=new Object() + val.software.firmware=new Object() + val.software.firmware.release='0.3' + val.legacy=true + val.software.autoupdater=new Object() + val.software.autoupdater.enabled=false + if(val.geo){ + val.location=new Object(); + val.location.longitude=val.geo[0]; + val.location.latitude=val.geo[1]; + } + fill_arr(key,val,!val.flags.online) + if (val.flags.online) count_online++ + else count_offline++ + } + }); + $('#subheadline').append("
Step "+(++step)+' nodes.json'); + $('#subheadline').append(" "+count_online+" online"); + $('#subheadline').append(" "+count_offline+" offline"); + $('#headings th').click(function() { + var id = $(this).attr('id'); + var asc = (!$(this).attr('asc')); // switch the order, true if not set - sortResults(id, asc); - }); + // set asc="asc" when sorted in ascending order + $('#headings th').each(function() { + $(this).removeAttr('asc'); + }); + if (asc) $(this).attr('asc', 'asc'); - sortResults('hostname', true); + sortResults(id, asc); + }); - $('#subheadline').append(" "+count_online+" online"); - }); - - }); - /*$(function() { - $.getJSON( 'nodes.json', function(data) { - $.each( data.nodes, function( key,val ) { - val.hostname=val.name - key=val.id; - if(val.name=="") valname=val.id; - val.legacy=true - fill_arr(key,val,!val.flags.online) - if (val.flags.online) count_online++ - else count_offline++ + sortResults('hostname', true); + }); }); - $('#subheadline').append(" "+count_offline+" offline"); }); - - });*/ + }); function order(c) { if (/^\d$/.test(c)) @@ -243,8 +253,8 @@ +'
' +''+Math.floor(arr[e].uptime/3600)+'h' +''+(arr[e].offline?"offline":'')+'' - +'' - +'' + +'' + +'' +'' +'' +'' @@ -253,8 +263,8 @@ +'' +'' +'' - +'' - +'' + +'' + +'' +'' +'' +''+Math.floor(arr[e].uptime/3600)+'h' - +''+(arr[e].offline?"offline":'')+'' + +''+(arr[e].offline===1?"offline":'')+'' +'' +'' +'' @@ -260,10 +259,9 @@ +'' +'' +'' - +'' - +'' + +'' +'' - +'' + +'' +'' +' - - + From 26e6b4acaab1e4bcc8f9d4210393f3c9329f7ab5 Mon Sep 17 00:00:00 2001 From: ruben Date: Mon, 4 Aug 2014 02:23:29 +0200 Subject: [PATCH 27/39] only try to download node detail json for alfred-nodes --- www/alfred.html | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index a1cfbae..190c9b6 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -42,6 +42,7 @@ "autoupdate", "contact", "longitude", + "latitude", "loadavg", "mem" ]; @@ -81,8 +82,10 @@ try { n.contact= ('owner' in val?val['owner']['contact']:'') ; } catch (e) {}; try { n.longitude= ('location' in val?val['location']['longitude']:'') ; } catch (e) {}; try { n.latitude= ('location' in val?val['location']['latitude']:'') ; } catch (e) {}; - try { if(val['clientcount']) n.clientcount= val['clientcount'] ; } catch (e) {}; try { n.mac= key ; } catch (e) {}; + // legacy: + try { if(val['clientcount']) n.clientcount= val['clientcount'] ; } catch (e) {}; + try { if(val['legacy']) n.legacy= val['legacy'] ; } catch (e) {}; arr.push(n); } } @@ -126,7 +129,7 @@ val.location.latitude=val.geo[0]; val.location.longitude=val.geo[1]; } - fill_arr(key,val,!val.flags.online) + fill_arr(key,val, (val.flags.online?0:1)) if (val.flags.online) count_online++ else count_offline++ } @@ -251,7 +254,7 @@ html += '' +'' +''+Math.floor(arr[e].uptime/3600)+'h' - +''+(arr[e].offline===1?"offline":'')+'' + +''+(arr[e].offline===1?"offline":(arr[e].offline?arr[e].offline:''))+'' +'' +'' +'' @@ -274,13 +277,13 @@ } // add last access time to offline nodes var xhrs = arr.map(function(node,e) { - if(node.offline){ + if(node.offline && !node.legacy){ var nodename = node.hostname; return $.ajax({ url: path_to_node_json + nodename }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); - $('#offline_'+e).append("
seit: " +pad(since.getDate())+'.'+pad(since.getMonth())+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth())+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); }); } }); From 6def6a4ac348b09cba9c5444882bb99199560059 Mon Sep 17 00:00:00 2001 From: ruben Date: Mon, 4 Aug 2014 02:35:24 +0200 Subject: [PATCH 28/39] show distribution instead of firmware on gateways --- www/alfred.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/alfred.html b/www/alfred.html index 190c9b6..1561d49 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -76,7 +76,7 @@ n.mem= parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['free']:1.0) / parseFloat(val['statistics']['memory'] != null?val['statistics']['memory']['total']:0); } catch (e) {}; } - try { n.firmware=val.software?val['software']['firmware']['release']:"-" ;} catch (e) {}; + try { n.firmware=val.software?val['software']['firmware']['release']:(val.distribution?val.distribution:"-");} catch (e) {}; try { n.model= val['hardware']?val['hardware']['model']:"-" ; } catch (e) {}; try { n.autoupdate= val.software?(val.software.autoupdater.enabled?val.software.autoupdater.branch:''):'-' ; } catch (e) {}; try { n.contact= ('owner' in val?val['owner']['contact']:'') ; } catch (e) {}; From 42329648c9db30c1a5f2676cb40d5cd532ce687c Mon Sep 17 00:00:00 2001 From: Daniel Ehlers Date: Mon, 4 Aug 2014 19:01:25 +0200 Subject: [PATCH 29/39] more-info: Increment month of offline date by one. --- www/alfred.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/alfred.html b/www/alfred.html index 1561d49..651d1ed 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -283,7 +283,7 @@ url: path_to_node_json + nodename }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); - $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth())+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); }); } }); From 0e72bdb720e6e51e1f3c4158fec989e6fa933f74 Mon Sep 17 00:00:00 2001 From: ruben Date: Tue, 5 Aug 2014 23:28:27 +0200 Subject: [PATCH 30/39] fixed: offline vpn gateways crashed the alfred_offline generation --- bin/alfred-log.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/alfred-log.py b/bin/alfred-log.py index 7d2da95..b9aa5f4 100755 --- a/bin/alfred-log.py +++ b/bin/alfred-log.py @@ -35,7 +35,13 @@ on_fp=open(folder+on_hostname,'r') on_json=on_fp.read() on=json.loads(on_json) - ons.append('"%s":%s' % (on["network"]["mac"], on_json)) + if not 'distribution' in on: + try: + ons.append('"%s":%s' % (on["network"]["mac"], on_json)) + except: + print on + sys.exit('ERROR: ["network"]["mac"] not in JSON object') + # offline nodes (on): offline=open('alfred_offline.json', 'w') From 4f341e52bbb9d8cf218085bc2a294e9ee9d84b9e Mon Sep 17 00:00:00 2001 From: ruben Date: Wed, 13 Aug 2014 21:35:43 +0200 Subject: [PATCH 31/39] Log legacy nodes also --- README.md | 3 ++- bin/alfred-log.py | 2 ++ bin/nodes-log.py | 38 ++++++++++++++++++++++++++++++++++++++ bin/update-json.sh | 2 ++ www/alfred.html | 15 ++++++++++++--- 5 files changed, 56 insertions(+), 4 deletions(-) create mode 100755 bin/nodes-log.py diff --git a/README.md b/README.md index 79aa0a7..36e09e3 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,5 @@ The file `alfred.json` will be regularly downloaded into the `www` folder of thi The files `alfred-log.py` and `update-json.sh` from the `bin` folder have to stay in the same folder for example `/opt/ff/gluon-alfred-vis/bin/`. + *git repository:* https://github.com/ffnord/gluon-alfred-vis - + *online version:* http://freifunk.discovibration.de/gluon-alfred-vis/www/alfred.html \ No newline at end of file + + *online version Kiel:* http://freifunk.discovibration.de/gluon-alfred-vis/www/alfred.html + + *online version Hamburg:* http://freifunk.discovibration.de/ffhh/www/alfred.html \ No newline at end of file diff --git a/bin/alfred-log.py b/bin/alfred-log.py index b9aa5f4..024e9db 100755 --- a/bin/alfred-log.py +++ b/bin/alfred-log.py @@ -22,6 +22,8 @@ hostnames=[] # write all nodes in separate files under logs/nodes/ for i in nodes: + nodes[i]['last_seen_h']=h_datetime + nodes[i]['last_seen']=timestamp with open(folder+nodes[i]['hostname'], 'w') as fp: json.dump(nodes[i], fp) fp.close() diff --git a/bin/nodes-log.py b/bin/nodes-log.py new file mode 100755 index 0000000..42a991f --- /dev/null +++ b/bin/nodes-log.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +""" +This script splits all nodes in single files under logs/nodes and creates an nodes_offline.json file + +Syntax: python nodes-log.py < nodes.json +""" + +import json, sys, os, datetime, time + +# timestamp to be added in nodes_offline.json +timestamp = time.time() +h_datetime = datetime.datetime.fromtimestamp(timestamp).strftime('%d.%m %H:%M:%S') + +try: + nodes_data=json.load(sys.stdin) +except: + sys.exit('No JSON object could be decoded') + +nodes=nodes_data['nodes'] + +folder='logs/nodes_legacy/' +hostnames=[] +# write all online nodes in separate files under logs/nodes_legacy/ +for i in range(0, len(nodes)): + if nodes[i]['flags']['online'] and 'flags' in nodes[i] and 'legacy' in nodes[i]['flags'] and nodes[i]['flags']['legacy']: + if nodes[i]['name']=='': + nodes[i]['name']=nodes[i]['id'] + nodes[i]['last_seen_h']=h_datetime + nodes[i]['last_seen']=timestamp + with open(folder+nodes[i]['name'], 'w') as fp: + json.dump(nodes[i], fp) + fp.close() + hostnames.append(nodes[i]['name']) + +ons=[] + diff --git a/bin/update-json.sh b/bin/update-json.sh index 215da63..7588db3 100755 --- a/bin/update-json.sh +++ b/bin/update-json.sh @@ -39,4 +39,6 @@ ${BINPATH}/alfred-log.py < alfred.json # optional download legacy nodes.json if [ "$LEGACY_URL" != "" ]; then curl -o nodes.json "$LEGACY_URL" + cp nodes.json logs/nodes_$(date +%y%m%d-%H%M%S).json + ${BINPATH}/nodes-log.py < nodes.json fi \ No newline at end of file diff --git a/www/alfred.html b/www/alfred.html index 651d1ed..8cad408 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -27,7 +27,8 @@ } // each single node has its own json logged here: - path_to_node_json='logs/nodes/'; + path_to_nodes_json='logs/nodes/'; + path_to_nodes_legacy_json='logs/nodes_legacy/'; // all column heads: var cols = [ @@ -272,7 +273,7 @@ if(p!="pos") html += p + ':' + arr[e][p] + '
'; } } - html +='data' + html +='data' +'
'; } // add last access time to offline nodes @@ -280,7 +281,15 @@ if(node.offline && !node.legacy){ var nodename = node.hostname; return $.ajax({ - url: path_to_node_json + nodename + url: path_to_nodes_json + nodename + }).done(function(data, status, xhr) { + var since= new Date(xhr.getResponseHeader("Last-Modified")); + $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + }); + }else if(node.offline && node.legacy){ + var nodename = node.hostname; + return $.ajax({ + url: path_to_nodes_legacy_json + nodename }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); From d390ab9ec6eba525c9c4d441df7f2bc2be93172d Mon Sep 17 00:00:00 2001 From: ruben Date: Sat, 16 Aug 2014 14:28:11 +0200 Subject: [PATCH 32/39] show how many are offline and how many legacy were online --- www/alfred.html | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 8cad408..d3d4fdd 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -93,26 +93,28 @@ var step=0; var count_offline=0 var count_online=0 + var count_offline_seen=0 + var count_legacy=0 $(function() { // first add offline nodes + $('#subheadline').append("
Step "+(++step)+' alfred_offline.json'); $.getJSON( 'alfred_offline.json', function(data) { count_offline--; // first element is "additional_data" $.each( data, function( key,val ) { fill_arr(key,val,1) count_offline++ }) - $('#subheadline').append("
Step "+(++step)+' alfred_offline.json'); }).done(function(){ // add online nodes + $('#subheadline').append("
Step "+(++step)+' alfred.json'); $.getJSON( 'alfred.json', function(data) { $.each( data, function( key,val ) { fill_arr(key,val,0) count_online++ }); - - $('#subheadline').append("
Step "+(++step)+' alfred.json'); }).done(function(){ // get legacy nodes + $('#subheadline').append("
Step "+(++step)+' nodes.json'); $.getJSON( 'nodes.json', function(data) { $.each( data.nodes, function( key,val ) { if(!val.flags.client && !val.firmware){ @@ -131,13 +133,14 @@ val.location.longitude=val.geo[1]; } fill_arr(key,val, (val.flags.online?0:1)) - if (val.flags.online) count_online++ - else count_offline++ + if (val.flags.online) count_online++; + else count_offline++; + count_legacy++; } }); - $('#subheadline').append("
Step "+(++step)+' nodes.json'); - $('#subheadline').append(" "+count_online+" online"); - $('#subheadline').append(" "+count_offline+" offline"); + $('#subheadline').html(''); + $('#subheadline').append(" "+count_online+" online von "+(count_offline+count_online)+""); + $('#subheadline').append("
"+count_legacy+" haben noch kein gluon (legacy node)"); $('#headings th').click(function() { var id = $(this).attr('id'); var asc = (!$(this).attr('asc')); // switch the order, true if not set @@ -277,6 +280,7 @@ +''; } // add last access time to offline nodes + count_offline_seen=0; var xhrs = arr.map(function(node,e) { if(node.offline && !node.legacy){ var nodename = node.hostname; @@ -287,19 +291,26 @@ $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); }); }else if(node.offline && node.legacy){ + // legacy offline nodes var nodename = node.hostname; return $.ajax({ url: path_to_nodes_legacy_json + nodename }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); - $('#offline_'+e).append(" seit: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + $('#offline_'+e).html("zuletzt: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + count_offline_seen++; }); } }); + setTimeout('show_last_seen()',3000); + $('#results').html(html); $('#results').append(arr.length+" Einträge"); if(arr.length==0) alert("Fehler: kein Eintrag!"); } + function show_last_seen(){ + $('#subheadline').append("
aber "+count_offline_seen+" der legacy nodes waren nach dem 1.8.2014 zuletzt online"); + } From 4cb0d6e77f56b4a55a750895af447354a3435b1a Mon Sep 17 00:00:00 2001 From: ruben Date: Sat, 16 Aug 2014 22:50:34 +0200 Subject: [PATCH 33/39] show how many legacy nodes are online --- www/alfred.html | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index d3d4fdd..4c30ef4 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -93,7 +93,8 @@ var step=0; var count_offline=0 var count_online=0 - var count_offline_seen=0 + var count_legacy_offline_seen=0 + var count_legacy_online=0 var count_legacy=0 $(function() { // first add offline nodes @@ -133,14 +134,16 @@ val.location.longitude=val.geo[1]; } fill_arr(key,val, (val.flags.online?0:1)) - if (val.flags.online) count_online++; - else count_offline++; + if (val.flags.online) { + count_legacy_online++; + count_online++; + } else count_offline++; count_legacy++; } }); $('#subheadline').html(''); $('#subheadline').append(" "+count_online+" online von "+(count_offline+count_online)+""); - $('#subheadline').append("
"+count_legacy+" haben noch kein gluon (legacy node)"); + $('#subheadline').append("
"+count_legacy+" haben noch kein gluon (legacy node), davon "+count_legacy_online+" online"); $('#headings th').click(function() { var id = $(this).attr('id'); var asc = (!$(this).attr('asc')); // switch the order, true if not set @@ -280,7 +283,7 @@ +''; } // add last access time to offline nodes - count_offline_seen=0; + count_legacy_offline_seen=0; var xhrs = arr.map(function(node,e) { if(node.offline && !node.legacy){ var nodename = node.hostname; @@ -298,7 +301,7 @@ }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); $('#offline_'+e).html("zuletzt: " +pad(since.getDate())+'.'+pad(since.getMonth() +1)+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); - count_offline_seen++; + count_legacy_offline_seen++; }); } }); @@ -309,7 +312,7 @@ if(arr.length==0) alert("Fehler: kein Eintrag!"); } function show_last_seen(){ - $('#subheadline').append("
aber "+count_offline_seen+" der legacy nodes waren nach dem 1.8.2014 zuletzt online"); + $('#subheadline').append("
aber "+count_legacy_offline_seen+" der offline legacy nodes waren nach dem 1.8.2014 zuletzt online"); } From f49cbd9ad4d2f1291386cb6f109b2ca997d4727c Mon Sep 17 00:00:00 2001 From: ruben Date: Sun, 17 Aug 2014 12:45:02 +0200 Subject: [PATCH 34/39] Link to wiki page of kiel --- www/alfred.html | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 4c30ef4..25d9e25 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -29,7 +29,8 @@ // each single node has its own json logged here: path_to_nodes_json='logs/nodes/'; path_to_nodes_legacy_json='logs/nodes_legacy/'; - + siteurl='http://freifunk.in-kiel.de' + // all column heads: var cols = [ "hostname", @@ -142,8 +143,10 @@ } }); $('#subheadline').html(''); - $('#subheadline').append(" "+count_online+" online von "+(count_offline+count_online)+""); - $('#subheadline').append("
"+count_legacy+" haben noch kein gluon (legacy node), davon "+count_legacy_online+" online"); + count_total=(count_offline+count_online); + $('#subheadline').append(" "+count_online+" Knoten online von "+count_total+""); + $('#subheadline').append("
"+(count_online-count_legacy_online)+" aktuelle online von "+(count_total-count_legacy)+""); + $('#subheadline').append("
"+(count_legacy_online)+" legacy online von "+count_legacy+""); $('#headings th').click(function() { var id = $(this).attr('id'); var asc = (!$(this).attr('asc')); // switch the order, true if not set @@ -264,12 +267,14 @@ +''+(arr[e].offline===1?"offline":(arr[e].offline?arr[e].offline:''))+'' +'
' +'' - +'' + +'' +'' +'' +'' +'' - +'' + +'' +'' +'' +'' @@ -312,7 +317,7 @@ if(arr.length==0) alert("Fehler: kein Eintrag!"); } function show_last_seen(){ - $('#subheadline').append("
aber "+count_legacy_offline_seen+" der offline legacy nodes waren nach dem 1.8.2014 zuletzt online"); + $('#subheadline').append("
"+count_legacy_offline_seen+" der offline legacy nodes waren nach dem 1.8.2014 zuletzt online"); } From ca89c17ad8d10872b7a6347d8a5d8be7ee4fa2fd Mon Sep 17 00:00:00 2001 From: ruben Date: Sun, 17 Aug 2014 13:15:13 +0200 Subject: [PATCH 35/39] started localisation for different communities --- www/alfred.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 25d9e25..200df67 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -29,7 +29,17 @@ // each single node has its own json logged here: path_to_nodes_json='logs/nodes/'; path_to_nodes_legacy_json='logs/nodes_legacy/'; + + //TODO: dies anpassen, und auch die header line weiter unten + // ffhh + siteurl='http://hamburg.freifunk.net' + ffmap_path='nodes_ffhh/' + // ffhl + siteurl='http://luebeck.freifunk.net' + ffmap_path='map/' + // ffki siteurl='http://freifunk.in-kiel.de' + ffmap_path="ffmap/' // all column heads: var cols = [ @@ -268,13 +278,14 @@ +'' +'' +'' +'' +'' +'' +'' - +'' + +'' +'' +'' +'' From 66930b0886b68753d9150f91397efa9631f8cd51 Mon Sep 17 00:00:00 2001 From: ruben Date: Sun, 17 Aug 2014 13:24:05 +0200 Subject: [PATCH 36/39] added nodeplot statistic --- www/alfred.html | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 200df67..3eda2da 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -39,7 +39,7 @@ ffmap_path='map/' // ffki siteurl='http://freifunk.in-kiel.de' - ffmap_path="ffmap/' + ffmap_path='ffmap/' // all column heads: var cols = [ @@ -279,10 +279,17 @@ +'' +'' +'' - +'' + +'' +'' +'' +'' From a686e12e0067536eb8ae882e473830ae86bea10d Mon Sep 17 00:00:00 2001 From: ruben Date: Sun, 17 Aug 2014 14:35:41 +0200 Subject: [PATCH 37/39] replace colons in link no nodes in luebeck links --- www/alfred.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/alfred.html b/www/alfred.html index 3eda2da..6354676 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -287,7 +287,7 @@ +'' +'' +'' From c9da228066084ec011fd2200bce2792f56a20e8f Mon Sep 17 00:00:00 2001 From: ruben Date: Sun, 17 Aug 2014 15:26:57 +0200 Subject: [PATCH 38/39] if there are no offline nodes, ",".join(ons) must return {} --- bin/alfred-log.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/alfred-log.py b/bin/alfred-log.py index 024e9db..0ed58ad 100755 --- a/bin/alfred-log.py +++ b/bin/alfred-log.py @@ -47,5 +47,9 @@ # offline nodes (on): offline=open('alfred_offline.json', 'w') -offline.write('{"additional_data": {"datetime": "%s", "timestamp": "%s"}, %s}' % (h_datetime, timestamp, ",".join(ons))) +joined_ons=",".join(ons) +# if there are no offline nodes, ",".join(ons) should return {} +if joined_ons=='': + joined_ons='"0":{}' +offline.write('{"additional_data": {"datetime": "%s", "timestamp": "%s"}, %s}' % (h_datetime, timestamp, joined_ons)) offline.close() From 147aa2371ba6eea9d5a6092ca5dcb0940419f99a Mon Sep 17 00:00:00 2001 From: ruben Date: Thu, 21 Aug 2014 22:19:40 +0200 Subject: [PATCH 39/39] setTimeout set to 10s because sometimes it takes some time to load all data to calculate the number of seen offline nodes --- www/alfred.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/alfred.html b/www/alfred.html index 6354676..6c91936 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -328,7 +328,7 @@ }); } }); - setTimeout('show_last_seen()',3000); + setTimeout('show_last_seen()',10000); $('#results').html(html); $('#results').append(arr.length+" Einträge");
'+nodename+''+Math.floor(arr[e].tx/1048576)+''+Math.floor(arr[e].rx/1048576)+''+(arr[e].tx?(Math.floor(arr[e].tx/1048576)):'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware+''+arr[e].model+''+arr[e].mac+''+arr[e].longitude+''+arr[e].latitude+''+arr[e].autoupdate+''+arr[e].loadavg+''+(arr[e].mem*100).toFixed(2)+'%'+(arr[e].loadavg?arr[e].loadavg:'')+''+(arr[e].mem?(arr[e].mem*100).toFixed(2)+'%':'')+''; for (var p in arr[e]) { if (arr[e].hasOwnProperty(p) && !inArray(p,cols)) { @@ -272,7 +282,7 @@ url: path_to_node_json + nodename }).done(function(data, status, xhr) { var since= new Date(xhr.getResponseHeader("Last-Modified")); - $('#offline_'+e).append("
seit: " +pad(since.getDay())+'.'+pad(since.getMonth())+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); + $('#offline_'+e).append("
seit: " +pad(since.getDate())+'.'+pad(since.getMonth())+'. '+ pad(since.getHours())+':'+pad(since.getMinutes())); }); } }); From 7517cb829f4d912eec4fa5a19a6c98a6fbebcb0d Mon Sep 17 00:00:00 2001 From: ruben Date: Mon, 4 Aug 2014 02:04:45 +0200 Subject: [PATCH 26/39] add links to map from geo coords #6 --- www/alfred.html | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/www/alfred.html b/www/alfred.html index 2fa0d9e..a1cfbae 100644 --- a/www/alfred.html +++ b/www/alfred.html @@ -42,7 +42,6 @@ "autoupdate", "contact", "longitude", - "latitude", "loadavg", "mem" ]; @@ -124,8 +123,8 @@ val.software.autoupdater.enabled=false if(val.geo){ val.location=new Object(); - val.location.longitude=val.geo[0]; - val.location.latitude=val.geo[1]; + val.location.latitude=val.geo[0]; + val.location.longitude=val.geo[1]; } fill_arr(key,val,!val.flags.online) if (val.flags.online) count_online++ @@ -252,7 +251,7 @@ html += '
'+nodename+''+(arr[e].tx?(Math.floor(arr[e].tx/1048576)):'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware+''+arr[e].mac+''+arr[e].autoupdate+''+arr[e].contact+''+arr[e].longitude+''+arr[e].latitude+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+arr[e].autoupdate+''+(arr[e].loadavg?arr[e].loadavg:'')+''+(arr[e].loadavg?arr[e].loadavg:'')+''+(arr[e].mem?(arr[e].mem*100).toFixed(2)+'%':'')+''; for (var p in arr[e]) { @@ -318,8 +316,7 @@

Knotenliste

mac autoupdate contactlonglatlocation autoupdate loadavg mem free
'+nodename+''+(arr[e].tx?(Math.floor(arr[e].tx/1048576)):'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware+'
'+(arr[e].tx?(Math.floor(arr[e].tx/1048576)):'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware+''+arr[e].firmware; + if(arr[e].firmware==0.3) html += ' mehr'; + html +=''+arr[e].model+''+arr[e].mac+''+arr[e].autoupdate+''+arr[e].contact+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+arr[e].autoupdate+''+(arr[e].loadavg?arr[e].loadavg:'')+''+(arr[e].mem?(arr[e].mem*100).toFixed(2)+'%':'')+' '+(arr[e].tx?(Math.floor(arr[e].tx/1048576)):'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware; - if(arr[e].firmware==0.3) html += ' mehr'; + // special for kiel: wiki page for legacy nodes + if(arr[e].firmware==0.3 && +siteurl=='http://freifunk.in-kiel.de') html += ' mehr'; html +=''+arr[e].model+''+arr[e].mac+''+arr[e].autoupdate+''+arr[e].contact+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+arr[e].autoupdate+''+(arr[e].loadavg?arr[e].loadavg:'')+''+(arr[e].mem?(arr[e].mem*100).toFixed(2)+'%':'')+''+(arr[e].rx?(Math.floor(arr[e].rx/1048576)):'')+''+arr[e].firmware; // special for kiel: wiki page for legacy nodes - if(arr[e].firmware==0.3 && +siteurl=='http://freifunk.in-kiel.de') html += ' mehr'; + site_is_ffki=(siteurl=='http://freifunk.in-kiel.de'); + site_is_ffhl=(siteurl=='http://luebeck.freifunk.net'); + + if(arr[e].firmware==0.3 && site_is_ffki) html += ' mehr'; html +=''+arr[e].model+''+arr[e].mac+'' + if(site_is_ffki) html +=''+arr[e].mac+'' + else if(site_is_ffhl) html +=''+arr[e].mac+'' + else html +=arr[e].mac; + html +=''+arr[e].autoupdate+''+arr[e].contact+''+(arr[e].longitude?(''+parseFloat(arr[e].longitude).toFixed(5)+' '+parseFloat(arr[e].latitude).toFixed(5)+''):'')+''+arr[e].model+'' if(site_is_ffki) html +=''+arr[e].mac+'' - else if(site_is_ffhl) html +=''+arr[e].mac+'' + else if(site_is_ffhl) html +=''+arr[e].mac+'' else html +=arr[e].mac; html +=''+arr[e].autoupdate+'