aredn: node description, lat/lon display, olsr entries (#163)

* aredn: node description on mesh page, lat/lon on both status and mesh, olsr entries

Added node description to mesh status page
Fixes #161

Added Lat/Lon (if available) to status and mesh pages.
It is diplayed above the description and under the node name.
Fixes #145

Added OLSR Routing tables entries to status page just under the memory area
Also added this same info just above the buttons on the mesh status page
Fixes #160

* aredn: OLSR routing table entries

Small addition to the displayed info

* aredn: corrections

move lat lon if statement farther up
changed system command lines to have () around them...

* aredn: added comments for new lines

* aredn: more corrections

back to using backticks on system commands per short discussion with ae6xe

* aredn: updated some lines so they will not toss warnings in the syntax tests
This commit is contained in:
Eric 2018-08-31 18:39:07 -07:00 committed by dman776
parent 7d0d258af7
commit ef6d092b2e
3 changed files with 41 additions and 2 deletions

View File

@ -102,6 +102,23 @@ system "mkdir -p /tmp/web";
system "touch /tmp/web/automesh" if $parms{auto}; system "touch /tmp/web/automesh" if $parms{auto};
system "rm -f /tmp/web/automesh" if $parms{stop}; system "rm -f /tmp/web/automesh" if $parms{stop};
#get location info if available
$lat_lon = "<strong>Location Not Available</strong>";
if(-f "/etc/latlon") {
$rcgood=open(FILE, "/etc/latlon");
if($rcgood) {
while(<FILE>){
chomp;
push @lat_lon,$_;
}
}
close(FILE);
$lat_lon = "<center><strong>Location: </strong> $lat_lon[0] $lat_lon[1]</center>";
}
$olsrTotal = `/sbin/ip route list table 30 | wc -l`; #num hosts olsr is keeping track of
$olsrNodes = `/sbin/ip route list table 30 | egrep "/" | wc -l`; #num *nodes* on the network (minus other hosts)
$node_desc = `/sbin/uci get system.\@system[0].description`; #pull the node description from uci
# parse the txtinfo output # parse the txtinfo output
$table = "none"; $table = "none";
@ -298,7 +315,12 @@ print "<center>\n";
alert_banner(); alert_banner();
# page header # page header
print "<h1>$node mesh status</h1><hr><nobr>"; print "<h1>$node mesh status</h1>";
print "$lat_lon"; #display lat lon info
print "<table id='node_description_display'><tr><td>$node_desc</td></tr></table>"; #display nide description
print "<hr><nobr>";
print "<table><th align='right'>OLSR Entries</th><td><nobr>Total = $olsrTotal<nobr><br><nobr>Nodes = $olsrNodes<nobr></td></table>"; #display OLSR numbers
# nav buttons # nav buttons
if(-f "/tmp/web/automesh") if(-f "/tmp/web/automesh")

View File

@ -635,7 +635,7 @@ print "
</tr> </tr>
<tr> <tr>
<td>Node Description (optional)</td> <td>Node Description (optional)</td>
<td><textarea rows='2' cols='60' wrap='soft' maxlength='210' id='node_description_entry' name='description_node' tabindex='4'>$description_node</textarea></td>"; <td><textarea rows='2' cols='60' wrap='soft' maxlength='210' id='node_description_entry' name='description_node' tabindex='4'>$desc</textarea></td>";
push @hidden, "<input type=hidden name=config value='mesh'>"; push @hidden, "<input type=hidden name=config value='mesh'>";
print " print "
<td>Verify Password</td> <td>Verify Password</td>

View File

@ -58,6 +58,21 @@ foreach(@wisections) {
$wifi_ssid = $_->{ssid}; $wifi_ssid = $_->{ssid};
} }
} }
#get location info if available
$lat_lon = "<strong>Location Not Available</strong>";
if(-f "/etc/latlon") {
$rcgood=open(FILE, "/etc/latlon");
if($rcgood) {
while(<FILE>){
chomp;
push @lat_lon,$_;
}
}
close(FILE);
$lat_lon = "<center><strong>Location: </strong> $lat_lon[0] $lat_lon[1]</center>";
}
$olsrTotal = `/sbin/ip route list table 30 | wc -l`; #num hosts olsr is keeping track of
$olsrNodes = `/sbin/ip route list table 30 | egrep "/" | wc -l`; #num *nodes* on the network (minus other hosts)
read_postdata(); read_postdata();
@ -78,6 +93,7 @@ alert_banner();
print "<h1><big>$node"; print "<h1><big>$node";
print " / $tactical" if $tactical; print " / $tactical" if $tactical;
print "</big></h1>"; print "</big></h1>";
print "<center>$lat_lon</center>"; #display location info
print "<table id='node_description_display'><tr><td>$node_desc</td></tr></table>" if $node_desc; print "<table id='node_description_display'><tr><td>$node_desc</td></tr></table>" if $node_desc;
print "<hr>\n"; print "<hr>\n";
@ -238,6 +254,7 @@ $str .= $space < 500 ? "<blink><b>$space KB</b></blink>" : "$space KB";
$str .= "</nobr></td>"; $str .= "</nobr></td>";
push @col2, $str; push @col2, $str;
push @col2, "<th align='right'>OLSR Entries</th><td><nobr>Total = $olsrTotal<nobr><br><nobr>Nodes = $olsrNodes<nobr></td>"; #display OLSR numbers
# now print the tables # now print the tables