summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/controller
diff options
context:
space:
mode:
Diffstat (limited to 'modules/admin-full/luasrc/controller')
-rw-r--r--modules/admin-full/luasrc/controller/admin/status.lua27
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 44acab472..7684e64c0 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