From: drowe67 Date: Mon, 6 Dec 2010 21:27:16 +0000 (+0000) Subject: Initial import of Google maps based mesh mapping tool for deugging Dili VT X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=67df166a989738749b89a3e1be175055fb57ec80;p=freetel-svn-tracking.git Initial import of Google maps based mesh mapping tool for deugging Dili VT git-svn-id: https://svn.code.sf.net/p/freetel/code@256 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/dilimesh/README.txt b/dilimesh/README.txt new file mode 100644 index 00000000..7d0fd4c2 --- /dev/null +++ b/dilimesh/README.txt @@ -0,0 +1,237 @@ +README.txt for dilimesh +David Rowe +Dec 7 2010 + + +Introduction +------------ + +Simple mesh network mapping application (web app) used as a test bed +for link debugging techniques in the Dili Village Telco. + +* Screen shot: dilimesh_screenshot.png + +* Currently displays packet loss stats as an alternative to batman + scores. The purpose of this project is to experiment with the + display of different information, for example display signal + strength or even a spectrum of local Wifi activity for each nodes. + The goal is gather information to debug problem links. + +* Based on Google maps V3 API. + +* Light weight: On the server we have just a few CGIs and a text file + database. A browser cookie is used for storing configuration + information. The CGIs are a few lines of shell script, so can run + on any machine. Installation involves copying a few files and + setting a few permissions. + +* Loosely coupled design: Can work without any additional software on + each mesh mode, just needs a Visualisation server somewhere in the + mesh. + + +Status +------ + +* Alpha +* Tested on Firefox 3.5.3 with Apache2 server +* Tested on small 5 node mesh network, might needs tweaks (e.g. fping + arguments) for larger networks +* Displays nodes, link paths, node IP and packet loss +* Signal strength per link feature under development + + +Implementation Notes +-------------------- + +Dilimesh is implemented in Javascript (dilimesh.html). A simple text +database file /var/www/dilimesh/nodes.txt is used to store node +locations and IPs. Browser cookies are used to store config +information like our last map location and vis server IP. Very simple +1 page CGIs written in shell script are used to access the node +database. + +The 'Set' buttons on the RHS cause dilimesh.html to reload with CGI +type variables passed to it. However these variables are not used, we +use onclick() methods to change the state variables which are stored +in a cookie when the page exits. + +All the CGI scripts assume a hard coded path of /var/www/dilimesh for +the nodes.txt database. + + +Directories +----------- + +"dilimesh" directory: + + dilimesh.html - all the Javascript for Dilimesh + dilimesh.css - style sheet + node_good.png + node_packet_loss.png + node_dead.png - node icon PNGs, changes with packet loss + +"cgi-bin" directory: + + addnode.cgi - adds a node to nodes.txt + delnode.cgi - deletes a node from nodes.txt + getnodes.cgi - reads nodes.txt database + getvis.cgi - reads vis server data + fpingnodes.cgi - fires off pings for all nodes, returns results + getsig.cgi - reads signal strength of surrounding nodes from one node, + requires sigstr.sh telnet daemon running on node. + +"scripts" directory: + + sigstr.sh - script that runs on MP as a telnet daemon to return signal + strength of each node to getsig.cgi. Experimental. + + +Software +-------- + +You need: + +1/ A web server. Apache is assumed in the /usr/lib/cgi-bin path below. + The paths may be different for other web servers. Note the path + to /var/www/dilimesh is hard coded in the CGI scripts so it's + best not to change that. + +2/ netcat (nc) and fping installed on the server. + +3/ A Batman mesh network with the vis server on one of the nodes, this + may already be running on your supernode. Batman on each node should + be configured for the vis server (e.g. -s 10.130.1.1) + +4/ A route from the web server PC to the mesh network. + + +Installation +------------ + +1/ Server PC + + # sudo mkdir /var/www/dilimesh + # sudo chmod 777 /var/www/dilimesh + # cp dilimesh/* /var/www/dilimesh + # cp cgi-bin/* /usr/lib/cgi-bin + +2/ Supernode + + Configure vis server to work on Wifi and Ethernet interfaces: + + # root@OpenWrt:~# cat /etc/config/vis + config vis general + option 'interface' 'ath0 eth0' + + If it's running OK you should see a process like: + + # ps | grep vis + 711 root 1508 S vis -j ath0 eth0 + +3/ Batman nodes + + Configure you nodes to use the visualisation server: + + # cat /etc/confog/batman + config batmand general + option interface ath0 + option announce + option gateway_class + option originator_interval + option preferred_gateway + option routing_class + option visualisation_srv 10.130.1.1 + option policy_routing_script + + When batman is running with the vis server it should look like: + + # ps | grep batman + 552 root 1564 S batmand -s 10.130.1.1 ath0 + + +Tests +----- + +1/ Server PC can reach node with vis server: + + $ ping 192.168.1.100 + +2/ Server PC has route to mesh nodes: + + $ ping 10.130.1.1 + $ ping 10.130.1.2 + +3/ Test you have installed fping: + + $ fping 10.130.1.1 + +4/ Test netcat and vis server: + + $ nc 192.168.1.100 2005 + + HTTP/1.0 200 OK + Content-type: application/json + + [ + { router : "10.130.1.1", neighbour : "10.130.1.23", label : 1.02 }, + { router : "10.130.1.14", neighbour : "10.130.1.56", label : 1.76 } + ] + +5/ Test CGIs: + + Point your browser at: + + http://localhost/cgi-bin/fpingnodes.cgi?ip=10.130.1.1 + +6/ Test reading and writing nodes.txt database with your browser: + + http://localhost/cgi-bin/addnode.cgi?lat=123&lng=456&ip=10.130.1.1 + + $ cat /var/www/dilimesh/nodes.txt + 123,456,10.130.1.1 + + http://localhost/cgi-bin/delnode.cgi?lat=123&lng=456&ip=10.130.1.1 + + $ cat /var/www/dilimesh/nodes.txt + (empty file) + + +Using Dilimesh +-------------- + +1/ Point your browser at http://server/dilimesh/dilimesh/html + +2/ Set "Visualisation Server IP" on RHS and reload page. + +3/ Dilimesh will find new nodes automatically. Drag bouncing nodes + to the correct position on map. + +4/ Mouse over or click to get node IP and packet loss. Right click to + delete node. Colours: + * blue - packet loss < 10% + * red - packet loss between 10% and 90% + * black - packet loss > 90% + +5/ "Update Enable" will update packet loss and network links + automatically. + + +Debugging +--------- + +1/ Monitor Apache log: + + $ tail -f /var/log/apache2/access.log + +2/ Use Firebug on Firefox. + +3/ Check nodes.txt database, each line is (lat, lng, IP): + + # cat /var/www/dilimesh/nodes.txt + + -34.88548650005714,138.55225324630737,10.130.1.56 + -34.88006501016277,138.55394840240479,10.130.1.1 + -34.87893842193011,138.55278968811035,10.130.1.23 + -34.882511765792316,138.55210304260254,10.130.1.14 + -34.880364257566484,138.5518455505371,10.130.1.36 diff --git a/dilimesh/cgi-bin/addnode.cgi b/dilimesh/cgi-bin/addnode.cgi new file mode 100755 index 00000000..bd78216e --- /dev/null +++ b/dilimesh/cgi-bin/addnode.cgi @@ -0,0 +1,31 @@ +#!/bin/sh +# addnode.cgi +# David Rowe 4 Dec 2010 +# +# CGI to add a new node + +cat < + + + + + +EOF + +lat=`echo "$QUERY_STRING" | sed -n "s/.*lat=\(.*\)&lng.*/\1/p"` +lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)&ip.*/\1/p"` +ip=`echo "$QUERY_STRING" | sed -n "s/.*ip=\(.*\)/\1/p"` + +echo $lat,$lng,$ip >> /var/www/dilimesh/nodes.txt + +echo $QUERY_STRING "
" +echo "
" +echo $lat $lng $ip + +cat < + +EOF diff --git a/dilimesh/cgi-bin/delnode.cgi b/dilimesh/cgi-bin/delnode.cgi new file mode 100755 index 00000000..5c8b115e --- /dev/null +++ b/dilimesh/cgi-bin/delnode.cgi @@ -0,0 +1,36 @@ +#!/bin/sh +# delnode.cgi +# David Rowe 4 Dec 2010 +# +# CGI to delete a node + +cat < + + + + + +EOF + +lat=`echo "$QUERY_STRING" | sed -n "s/lat=\(.*\)&.*/\1/pg"` +lng=`echo "$QUERY_STRING" | sed -n "s/.*lng=\(.*\)/\1/pg"` + +# path to node database text file + +P=/var/www/dilimesh + +cat $P/nodes.txt | sed "/$lat,$lng.*/ d" > $P/nodes.tmp +cp $P/nodes.tmp $P/nodes.txt +rm $P/nodes.tmp + +#echo $QUERY_STRING "
" +#echo "
" +#echo $lat $lng + +cat < + +EOF diff --git a/dilimesh/cgi-bin/fpingnodes.cgi b/dilimesh/cgi-bin/fpingnodes.cgi new file mode 100755 index 00000000..d0c19faf --- /dev/null +++ b/dilimesh/cgi-bin/fpingnodes.cgi @@ -0,0 +1,24 @@ +#!/bin/sh +# fpingnodes.cgi +# David Rowe 5 Dec 2010 +# +# CGI to fping a bunch of nodes + +cat < + + + + + +EOF + +ip=`echo "$QUERY_STRING" | sed -n "s/.*ip=//p" | sed "s/,/ /g"` +fping $ip -a -b1400 -r1 2>/dev/null + +cat < + +EOF diff --git a/dilimesh/cgi-bin/getnodes.cgi b/dilimesh/cgi-bin/getnodes.cgi new file mode 100755 index 00000000..7312089a --- /dev/null +++ b/dilimesh/cgi-bin/getnodes.cgi @@ -0,0 +1,30 @@ +#!/bin/sh +# getnodes.cgi +# David Rowe 5 Dec 2010 +# +# CGI to return node list from database text file +# We use a CGI rather than fetching the text file directly +# so we can control Firefox from caching + +cat < + + + + + + +EOF + +NODES=/var/www/dilimesh/nodes.txt + +if [ -f $NODES ] ; then + cat $NODES +fi + +cat < + +EOF diff --git a/dilimesh/cgi-bin/getsig.cgi b/dilimesh/cgi-bin/getsig.cgi new file mode 100755 index 00000000..24374443 --- /dev/null +++ b/dilimesh/cgi-bin/getsig.cgi @@ -0,0 +1,27 @@ +#!/bin/sh +# getsig.cgi +# David Rowe 6 Dec 2010 +# +# CGI to fetch the signal strength from a node +# Requires the node to be running sigstr.sh script as +# a telnet dameon port 4950 + +cat < + + + + + +EOF + +ip=`echo "$QUERY_STRING" | sed -n "s/.*ip=//p" | sed "s/,/ /g"` +echo $ip +nc $ip 4950 | sed -e "1d" + +cat < + +EOF diff --git a/dilimesh/cgi-bin/getvis.cgi b/dilimesh/cgi-bin/getvis.cgi new file mode 100755 index 00000000..a8723b79 --- /dev/null +++ b/dilimesh/cgi-bin/getvis.cgi @@ -0,0 +1,33 @@ +#!/bin/sh +# getvis.cgi +# David Rowe 4 Dec 2010 +# +# CGI to fetches vis server data +# I am sure it is possible to do this directly from Javascript +# but I am too much of a noob. + +cat < + + + + + +EOF + +VIS_SERVER_HOST=`echo "$QUERY_STRING" | sed -n "s/.*ip=//p"` + +nc $VIS_SERVER_HOST 2005 2>/dev/null >/dev/null +if [ $? -eq 0 ] ; then + nc $VIS_SERVER_HOST 2005 | sed -n "/{/ p" +else + echo "Can't connect to Visualisation Server on $VIS_SERVER_HOST" +fi + +cat < + +EOF + diff --git a/dilimesh/dilimesh/dilimesh.css b/dilimesh/dilimesh/dilimesh.css new file mode 100644 index 00000000..d72344f5 --- /dev/null +++ b/dilimesh/dilimesh/dilimesh.css @@ -0,0 +1,70 @@ +html,body{ + margin:0; + padding:0; + width:100%; + height:100%; + font-family:Arial, Helvetica, sans-serif; +} + +div#header{ + vertical-align:middle; + border-bottom:1px solid #000; +} +div#main-map{ + width:70%; + height:100%; + float:left; +} +div#side{ + width:30%; + float:left; +} + +div#dataPanel{ + width:90%; + height:50%; + overflow:auto; + border:2px solid #DDDDDD; +} +input{ + width:90%; +} + +input.navi{ + font-size:12px; + height:30px; + margin-bottom:10px; +} +div ul{ + margin-top:30px; + margin-bottom:30px; +} +div ul li{ + display: inline; + list-style-type: none; + padding-right: 40px; + font-size:18px; + font-weight:bold; +} + +div ul li.title{ + font-size:22px; + color:#888; +} + +div#header p{ + color:#888; + font-size:14px; + padding-left:20px; +} +span.instruction{ + font-weight:bold; + +} + +.message-box { text-align: center; padding: 5px; color:#545454; width:80%; margin:5px auto; font-size:12px;} +.clean { background-color: #efefef; border-top: 2px solid #dedede; border-bottom: 2px solid #dedede; } +.info { background-color: #f7fafd; border-top: 2px solid #b5d3ff; border-bottom: 2px solid #b5d3ff; } +.ok { background-color: #d7f7c4; border-top: 2px solid #82cb2f; border-bottom: 2px solid #82cb2f; } +.alert { background-color: #fef5be; border-top: 2px solid #fdd425; border-bottom: 2px solid #fdd425; } +.error { background-color: #ffcdd1; border-top: 2px solid #e10c0c; border-bottom: 2px solid #e10c0c; } \ No newline at end of file diff --git a/dilimesh/dilimesh/dilimesh.html b/dilimesh/dilimesh/dilimesh.html new file mode 100644 index 00000000..a72d3cbc --- /dev/null +++ b/dilimesh/dilimesh/dilimesh.html @@ -0,0 +1,837 @@ + + + + + + +Dili Mesh + + + + + + + + + +
+
+ +
+ +
+

Network Stats

+ + + + + +
Time
Nodes Reachable
Nodes Poor Packet Loss
Nodes Total
+
+ +
+

Contol Panel

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Visualisation Server IP
Update Enable
Update Time (s)
Debug Messages
+ + + +
+

Tests

+
    +
  1. Test nodes.txt database
    +
  2.  
    +
  3.  
    +
+
+ +
+

Debugging Output

+
    +
+
+ + + + + diff --git a/dilimesh/dilimesh/node_dead.png b/dilimesh/dilimesh/node_dead.png new file mode 100644 index 00000000..88be5501 Binary files /dev/null and b/dilimesh/dilimesh/node_dead.png differ diff --git a/dilimesh/dilimesh/node_good.png b/dilimesh/dilimesh/node_good.png new file mode 100644 index 00000000..056f1c9b Binary files /dev/null and b/dilimesh/dilimesh/node_good.png differ diff --git a/dilimesh/dilimesh/node_packet_loss.png b/dilimesh/dilimesh/node_packet_loss.png new file mode 100644 index 00000000..58420803 Binary files /dev/null and b/dilimesh/dilimesh/node_packet_loss.png differ diff --git a/dilimesh/dilimesh_screenshot.png b/dilimesh/dilimesh_screenshot.png new file mode 100644 index 00000000..e74f69f9 Binary files /dev/null and b/dilimesh/dilimesh_screenshot.png differ diff --git a/dilimesh/scripts/sigstr.sh b/dilimesh/scripts/sigstr.sh new file mode 100755 index 00000000..fd787d3d --- /dev/null +++ b/dilimesh/scripts/sigstr.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# node_tune.sh +# David Rowe 13 April 2010 +# +# Prints the IPs and signal strengths of nodes we can see. +# +# Run as a telnet login, e.g. on node 10.130.1.100 +# telnetd -l /usr/sbin/sigstr.sh -p 4950 +# Test: +# "telnet 10.130.1.100 4950" + + # list of nodes this node can see in IP and MAC order + + IP=`cat /proc/net/arp | grep "10.130.1" | awk '{ print $1 }'` + MAC=`cat /proc/net/arp | grep "10.130.1" | awk '{ print $4 }'` + + echo $IP + for m in $MAC + do + wlanconfig ath0 list | grep $m | awk '{ printf " %s",$6 }' + done + echo + + + +