| Zeile 12: |
Zeile 12: |
| | | | |
| | ===Lösung Programm=== | | ===Lösung Programm=== |
| − | Hier schonmal ein alpha-release 8-) | + | Hier schonmal ein beta-release 8-) |
| | Einfach ausschneiden & auf den Router kopieren...(naja,fast...) | | Einfach ausschneiden & auf den Router kopieren...(naja,fast...) |
| | <pre> | | <pre> |
| | #!/bin/sh | | #!/bin/sh |
| | # | | # |
| − | # version.......: infopage_05-jan-2005 | + | # version.......: infopage_06-jan-2005 |
| | # author........: bastian bittorf | | # author........: bastian bittorf |
| − | # contact.......: infopage.20.bastian@spamgourmet.org | + | # contact.......: infopage.20.bastian at spamgourmet dot org |
| | # licence.......: GPL | | # licence.......: GPL |
| − | # requirements..: 600kb runtime-memory | + | # requirements..: 900kb runtime-memory |
| | + | # tools needed..: ash,wl,busybox (awk,cat,cut,echo,grep,ipcalc,wget) |
| | # tested........: fff v1.0.7 | | # tested........: fff v1.0.7 |
| | # | | # |
| | # This script generates helpful infos about your fff-openwrt-router | | # This script generates helpful infos about your fff-openwrt-router |
| | # Its main purpose was to avoid loading hundreds of kilobytes from | | # Its main purpose was to avoid loading hundreds of kilobytes from |
| − | # slow longrange wireless-links only to know some unmuch infos | + | # slow longrange wireless-links only to get some infos. |
| − | # Output should be HTML,but human AND machine-readable. | + | # Output is HTML,but human AND machine-readable. |
| − | # Total data-output should not be around 1000 bytes. | + | # Total data-output should be around 1000 bytes. |
| | + | # |
| | + | # ToDo: |
| | + | # - determine exact hardware type from board values ("wrt54gs v1.1") |
| | + | # - traceroutes to all internetgateways |
| | + | # - localisation english,france (all in one file) |
| | + | # - determine runtime and memoryusage for each task |
| | + | # - automatically create network-topologie (SVG) |
| | + | # - reduce memoryusage |
| | + | # - speedups |
| | # | | # |
| − | # Which programs are needed to un this?
| |
| − | # ash,wl,busybox (awk,cat,echo,grep,ipcalc,wget)
| |
| − | #
| |
| | # ----------------------------------------------------------------- | | # ----------------------------------------------------------------- |
| | # | | # |
| Zeile 44: |
Zeile 51: |
| | | | |
| | # | | # |
| − | # Evaluation query-string | + | # Evaluating query-string |
| | # For faster access the hole infopage will be silently generated | | # For faster access the hole infopage will be silently generated |
| | # trough crond every 15mins. Only if you specify an url+"?l" | | # trough crond every 15mins. Only if you specify an url+"?l" |
| | # you get livedata, but you have to wait some seconds. | | # you get livedata, but you have to wait some seconds. |
| | + | # If query is not "l", precalculated page is delivered. |
| | # | | # |
| | | | |
| − | if [ "$QUERY_STRING" = "l" ]; then echo "live daten...";fi | + | if [ "$QUERY_STRING" != "l" ]; then cat /tmp/infopage.txt;exit;fi |
| − | | |
| − | #
| |
| − | # Evaluation query-string
| |
| − | # If the clientbrowsers query is not "l" get lifedata.
| |
| − | #
| |
| − | | |
| − | if [ "$QUERY_STRING" != "l" ]; then echo "generierte page...";fi
| |
| | | | |
| | # | | # |
| Zeile 264: |
Zeile 265: |
| | # is filled with (for this skript) useless infos. | | # is filled with (for this skript) useless infos. |
| | # CPU-load is given in percent. Its wrong but nicer 8-) | | # CPU-load is given in percent. Its wrong but nicer 8-) |
| | + | # Does anyone need bogomips? |
| | # | | # |
| | | | |
| Zeile 371: |
Zeile 373: |
| | # INET-gateways | | # INET-gateways |
| | # All 0.0.0.0/0-HNA4-Announced inet-gateways. | | # All 0.0.0.0/0-HNA4-Announced inet-gateways. |
| − | # Later I want to include tracerout-outputs to every IP | + | # Sorted, best ETX-values are top. |
| | + | # Later I want to include traceroute-outputs to every IP |
| | # and the affiliated and summarized ETX-values | | # and the affiliated and summarized ETX-values |
| − | # traceroute 10.11.12.3 -w 3 -n 2>/dev/null | awk '{if($2=="*"){print "error";exit} else printf $2" -> " }') | + | # Maybe i should alter the downloadtime (5sec) in |
| | + | # reference to ETX (better statistical method). |
| | # | | # |
| | | | |
| − | echo "<b>INETGATES</b>" | + | echo "<b>ETX/INETGATE/SPEED</b>" |
| − | wget -O - http://127.0.0.1:8080/nodes|awk -F "<" '{ | + | a=$(wget -O - http://127.0.0.1:8080/nodes|awk -F "<" '{ |
| − | if(substr($0,1,40)=="<tr><td>0.0.0.0</td><td>0.0.0.0</td><td>") | + | if($0=="<h2>MID entries</h2>"){ |
| − | print substr($7,4)}'
| + | print "EOF" |
| | + | exit} |
| | + | if(substr($0,1,40)=="<tr><td>0.0.0.0</td><td>0.0.0.0</td><td>"){ |
| | + | z=substr($7,4) |
| | + | printf z" (" |
| | + | system("wget -qO /tmp/testdownload http://"z"/cgi-bin-dev-zero.bin &") |
| | + | system("sleep 5") |
| | + | system("kill 2>/dev/null $(ps|grep qO|grep -v grep|cut -b 0-5)") |
| | + | system("a=$(ls -l /tmp/testdownload|cut -b 30-42);let b=a/5120;echo -n $b") |
| | + | system("echo "0" >/tmp/testdownload") |
| | + | print "kb/s)"}}') |
| | + | echo $a|awk '{ |
| | + | split($0,b) |
| | + | while(b[c+1]!="EOF"){ |
| | + | c++ |
| | + | while("wget -O - http://127.0.0.1:8080/routes"|getline){ |
| | + | split($0,r,"<td>") |
| | + | z=substr(r[2],1,length(r[2])-5) |
| | + | if(length(z)>0) |
| | + | if(z==b[c]){ |
| | + | etx=substr(r[5],1,length(r[5])-5) |
| | + | if(etx>99) |
| | + | etx="99.99" |
| | + | printf "%5.2f",etx |
| | + | printf " - " |
| | + | printf b[c] |
| | + | printf " - " |
| | + | print b[c+1] |
| | + | break |
| | + | }} |
| | + | c++ |
| | + | close("wget -O - http://127.0.0.1:8080/routes") |
| | + | }}'| |
| | + | sort |
| | | | |
| | # | | # |
| − | # Neighborhood | + | # Neighbourhood |
| − | # All direct neighbors, sorted. | + | # All direct neighbours, sorted. |
| | # Best ETX-values are bottom. | | # Best ETX-values are bottom. |
| | # ETX > 99 will be "translated" to 99. | | # ETX > 99 will be "translated" to 99. |
| | # This means "senseless". | | # This means "senseless". |
| − | # Maybe i should also filter ETX 0.00 | + | # An endless-download from each neighbour |
| | + | # is made for 5 seconds via wget. |
| | + | # Is there a better way? I you are |
| | + | # "unlucky" you get ~1500kb (300*5s). |
| | + | # Maybe i should also filter ETX 0.00 ? |
| | # Maybe i should make hyperlinks for faster | | # Maybe i should make hyperlinks for faster |
| − | # exploring some nodes. (more output!) | + | # exploring some nodes ? (more output!) |
| | # | | # |
| | | | |
| − | echo "<b>ETX/NACHBARN</b>" | + | echo "<b>ETX/NACHBAR/SPEED</b>" |
| | wget -O - http://127.0.0.1:8080/nodes|awk '{ | | wget -O - http://127.0.0.1:8080/nodes|awk '{ |
| − | if($0=="</table>")exit | + | if($0=="</table>") |
| | + | exit |
| | a++ | | a++ |
| | if(a>21){ | | if(a>21){ |
| | split($0,b,"</td><td>") | | split($0,b,"</td><td>") |
| | c=substr(b[8],1,4) | | c=substr(b[8],1,4) |
| − | if(c>99)c="99.99" | + | if(c>99) |
| | + | c="99.99" |
| | printf "%5.2f ",c | | printf "%5.2f ",c |
| − | print "- "b[2]}}'| | + | z=b[2] |
| | + | printf "- "z" - (" |
| | + | system("wget -qO /tmp/testdownload http://"z"/cgi-bin-dev-zero.bin &") |
| | + | system("sleep 5") |
| | + | system("kill 2>/dev/null $(ps|grep qO|grep -v grep|cut -b 0-5)") |
| | + | system("a=$(ls -l /tmp/testdownload|cut -b 30-42);let b=a/5120;echo -n $b") |
| | + | system("echo "0" >/tmp/testdownload") |
| | + | print "kb/s)"}}'| |
| | sort | | sort |
| | | | |
| Zeile 423: |
Zeile 473: |
| | # HTML-endtag is not needed 8-) | | # HTML-endtag is not needed 8-) |
| | # | | # |
| − | #
| |
| − |
| |
| | </pre> | | </pre> |
| | | | |