diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-28 18:01:07 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-28 18:01:07 +0000 |
commit | ceff3fc35cb86259370146aac00a5db6bd8434a6 (patch) | |
tree | 1e6c5483486e5f910fd2dc3dfbc482b53263607f /modules/admin-full/luasrc/controller/admin | |
parent | 750b02349417205cfbdfc4a0c49a858f72ab0aa5 (diff) |
modules/admin-full: implement connection graph, cross browser fixes
Diffstat (limited to 'modules/admin-full/luasrc/controller/admin')
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/status.lua | 27 |
1 files changed, 27 insertions, 0 deletions
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 |