summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/src/controller/rpc/luciinfo.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-05-08 16:04:18 +0000
committerSteven Barth <steven@midlink.org>2008-05-08 16:04:18 +0000
commit214bfdc19887c3df373d1323afd9738eee4f64ca (patch)
tree1b3660fd9a8db552d50c9ef9d11b9dee35bf8fac /modules/freifunk/src/controller/rpc/luciinfo.lua
parentaa9ccf77c6648515ba58c37b9345cdbd561028db (diff)
* Fixed #2030
Diffstat (limited to 'modules/freifunk/src/controller/rpc/luciinfo.lua')
-rw-r--r--modules/freifunk/src/controller/rpc/luciinfo.lua41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/freifunk/src/controller/rpc/luciinfo.lua b/modules/freifunk/src/controller/rpc/luciinfo.lua
new file mode 100644
index 000000000..611423fbb
--- /dev/null
+++ b/modules/freifunk/src/controller/rpc/luciinfo.lua
@@ -0,0 +1,41 @@
+module("ffluci.controller.rpc.luciinfo", package.seeall)
+
+function action_index()
+ local uci = ffluci.model.uci.StateSession()
+
+ ffluci.http.prepare_content("text/plain")
+
+ -- General
+ print("luciinfo.api=1")
+ print("luciinfo.version=" .. tostring(ffluci.__version__))
+
+ -- Sysinfo
+ local s, m, r = ffluci.sys.sysinfo()
+ local dr = ffluci.sys.net.defaultroute()
+ dr = dr and ffluci.sys.net.hexip4(dr.Gateway) or ""
+ local l1, l5, l15 = ffluci.sys.loadavg()
+
+ print("sysinfo.system=" .. sanitize(s))
+ print("sysinfo.cpu=" .. sanitize(m))
+ print("sysinfo.ram=" .. sanitize(r))
+ print("sysinfo.hostname=" .. sanitize(ffluci.sys.hostname()))
+ print("sysinfo.load1=" .. tostring(l1))
+ print("sysinfo.load5=" .. tostring(l5))
+ print("sysinfo.load15=" .. tostring(l15))
+ print("sysinfo.defaultgw=" .. dr)
+
+
+ -- Freifunk
+ local ff = uci:sections("freifunk") or {}
+ for k, v in pairs(ff) do
+ if k:sub(1, 1) ~= "." then
+ for i, j in pairs(v) do
+ print("freifunk." .. k .. "." .. i .. "=" .. j)
+ end
+ end
+ end
+end
+
+function sanitize(val)
+ return val:gsub("\n", "\t")
+end \ No newline at end of file