diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-13 07:27:34 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-13 07:27:34 +0000 |
commit | 2bc02e44b41ffbfcc0ccad59d09409b6bee5bbef (patch) | |
tree | 1478a5eb98567745d0fa30b51510ce0c42dcc795 /modules/admin-full/luasrc/controller/admin | |
parent | 5d10db24ef0fa5a0226aba88b26a41511c1cefcb (diff) |
modules/admin-full: add wireless live stats
Diffstat (limited to 'modules/admin-full/luasrc/controller/admin')
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/status.lua | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua index 61704ff55b..3b23055157 100644 --- a/modules/admin-full/luasrc/controller/admin/status.lua +++ b/modules/admin-full/luasrc/controller/admin/status.lua @@ -16,6 +16,8 @@ $Id$ module("luci.controller.admin.status", package.seeall) function index() + local function _(x) return x end + entry({"admin", "status"}, alias("admin", "status", "overview"), _("Status"), 20).index = true entry({"admin", "status", "overview"}, template("admin_status/index"), _("Overview"), 1) entry({"admin", "status", "iptables"}, call("action_iptables"), _("Firewall"), 2).leaf = true @@ -29,7 +31,10 @@ function index() entry({"admin", "status", "bandwidth"}, template("admin_status/bandwidth"), _("Realtime Traffic"), 7).leaf = true entry({"admin", "status", "bandwidth_status"}, call("action_bandwidth")).leaf = true - entry({"admin", "status", "connections"}, template("admin_status/connections"), _("Realtime Connections"), 8).leaf = true + entry({"admin", "status", "wireless"}, template("admin_status/wireless"), _("Realtime Wireless"), 8).leaf = true + entry({"admin", "status", "wireless_status"}, call("action_wireless")).leaf = true + + entry({"admin", "status", "connections"}, template("admin_status/connections"), _("Realtime Connections"), 9).leaf = true entry({"admin", "status", "connections_status"}, call("action_connections")).leaf = true entry({"admin", "status", "processes"}, cbi("admin_status/processes"), _("Processes"), 20) @@ -86,6 +91,27 @@ function action_bandwidth() end end +function action_wireless() + local path = luci.dispatcher.context.requestpath + local iface = path[#path] + + luci.http.prepare_content("application/json") + + local bwc = io.popen("luci-bwc -r %q 2>/dev/null" % iface) + 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 +end + function action_load() luci.http.prepare_content("application/json") |