From ceff3fc35cb86259370146aac00a5db6bd8434a6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 28 Nov 2010 18:01:07 +0000 Subject: modules/admin-full: implement connection graph, cross browser fixes --- .../admin-full/luasrc/controller/admin/status.lua | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'modules/admin-full/luasrc/controller/admin') diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua index 44acab4721..7684e64c0e 100644 --- a/modules/admin-full/luasrc/controller/admin/status.lua +++ b/modules/admin-full/luasrc/controller/admin/status.lua @@ -31,6 +31,8 @@ function index() entry({"admin", "status", "bandwidth"}, template("admin_status/bandwidth"), i18n("Realtime Traffic"), 8).leaf = true entry({"admin", "status", "bandwidth_status"}, call("action_bandwidth")).leaf = true + entry({"admin", "status", "connections"}, template("admin_status/connections"), i18n("Realtime Connections"), 9).leaf = true + entry({"admin", "status", "connections_status"}, call("action_connections")).leaf = true end function action_syslog() @@ -111,3 +113,28 @@ function action_load() luci.http.status(404, "No data available") end + +function action_connections() + local fs = require "luci.fs" + if fs.access("/var/lib/luci-bwc/connections") then + luci.http.prepare_content("application/json") + + local bwc = io.popen("luci-bwc -c 2>/dev/null") + if bwc then + luci.http.write("[") + + while true do + local ln = bwc:read("*l") + if not ln then break end + luci.http.write(ln) + end + + luci.http.write("]") + bwc:close() + end + + return + end + + luci.http.status(404, "No data available") +end -- cgit v1.2.3