mirror of https://github.com/aredn/aredn.git
Display and correct from olsr_hosts totals rather than olsr json (#520)
* Display hosts totals rather than olsr totals * Don't count hostname beginning mid<nr>.
This commit is contained in:
parent
10bedbaf48
commit
c7538884ca
|
@ -42,7 +42,6 @@ require("aredn.utils")
|
||||||
local html = require("aredn.html")
|
local html = require("aredn.html")
|
||||||
require("uci")
|
require("uci")
|
||||||
local aredn_info = require("aredn.info")
|
local aredn_info = require("aredn.info")
|
||||||
local olsr = require("aredn.olsr")
|
|
||||||
|
|
||||||
-- helpers start
|
-- helpers start
|
||||||
|
|
||||||
|
@ -179,15 +178,15 @@ if lat and lon then
|
||||||
lat_lon = string.format("<center><strong>Location: </strong> %s %s</center>", lat, lon)
|
lat_lon = string.format("<center><strong>Location: </strong> %s %s</center>", lat, lon)
|
||||||
end
|
end
|
||||||
|
|
||||||
local olsr_routes = olsr.getOLSRRoutes()
|
local host_total = 0
|
||||||
local olsr_total = 0
|
local host_nodes = 0
|
||||||
local olsr_nodes = 0
|
for line in io.lines("/var/run/hosts_olsr.stable")
|
||||||
for i, node in ipairs(olsr_routes)
|
|
||||||
do
|
do
|
||||||
if node.genmask ~= 0 then -- don't count default route
|
if line:match("^10%.") and not line:match("%smid%d+%.") then
|
||||||
olsr_total = olsr_total + 1
|
host_total = host_total + 1
|
||||||
if node.genmask ~= 32 then
|
local host = line:match("^10%..+%sdtdlink%.")
|
||||||
olsr_nodes = olsr_nodes + 1
|
if host then
|
||||||
|
host_nodes = host_nodes + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -397,7 +396,7 @@ else
|
||||||
end
|
end
|
||||||
|
|
||||||
col2[#col2 + 1] = "<th align=right valign=top><nobr>load average</nobr><br><nobr>free space</nobr></th><td>" .. string.format("%.2f, %.2f, %.2f", sysinfo.loads[1], sysinfo.loads[2], sysinfo.loads[3]) .. "<br><nobr>flash = " .. fspace .. "</nobr><br><nobr>/tmp = " .. tspace .. "</nobr><br><nobr>memory = " .. rspace .. "</nobr></td>";
|
col2[#col2 + 1] = "<th align=right valign=top><nobr>load average</nobr><br><nobr>free space</nobr></th><td>" .. string.format("%.2f, %.2f, %.2f", sysinfo.loads[1], sysinfo.loads[2], sysinfo.loads[3]) .. "<br><nobr>flash = " .. fspace .. "</nobr><br><nobr>/tmp = " .. tspace .. "</nobr><br><nobr>memory = " .. rspace .. "</nobr></td>";
|
||||||
col2[#col2 + 1] = "<th align=right valign=top>OLSR Entries</th><td><nobr>Total = " .. olsr_total .. "<nobr><br><nobr>Nodes = " .. olsr_nodes .. "<nobr></td>"
|
col2[#col2 + 1] = "<th align=right valign=top>Host Entries</th><td><nobr>Total = " .. host_total .. "<nobr><br><nobr>Nodes = " .. host_nodes .. "<nobr></td>"
|
||||||
|
|
||||||
-- now print the tables
|
-- now print the tables
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue