Implemented local hosts looking glass (more criteria to be added)

This commit is contained in:
Luca Deri 2016-11-30 16:26:17 +01:00
parent 8263c1c65a
commit 091378fd7b
13 changed files with 412 additions and 55 deletions

View file

@ -57,6 +57,9 @@ interface.select(ifname)
host_info = url2hostinfo(_GET)
criteria = _GET["criteria"]
if(criteria == nil) then criteria = "" end
interface.select(ifname)
if(host_info["host"] ~= nil) then
@ -79,9 +82,16 @@ else
-- Get from redis the throughput type bps or pps
throughput_type = getThroughputType()
--tprint(host)
print("\"column_since\" : \"" .. secondsToTime(now-host["seen.first"]+1) .. "\", ")
print("\"column_last\" : \"" .. secondsToTime(now-host["seen.last"]+1) .. "\", ")
print("\"column_traffic\" : \"" .. bytesToSize(host["bytes.sent"]+host["bytes.rcvd"]).. "\", ")
label, fnctn = label2criteriakey(criteria)
c = host.criteria
print("\"column_"..criteria.."\" : \"" .. fnctn(c[label]).. "\", ")
if((host["throughput_trend_"..throughput_type] ~= nil)
and (host["throughput_trend_"..throughput_type] > 0)) then