From 2bc02e44b41ffbfcc0ccad59d09409b6bee5bbef Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 13 Sep 2011 07:27:34 +0000 Subject: modules/admin-full: add wireless live stats --- .../admin-full/luasrc/controller/admin/status.lua | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (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 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") -- cgit v1.2.3