2 LuCI - Lua Configuration Interface
4 Copyright 2008 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
14 module("luci.controller.freifunk.luciinfo", package.seeall)
17 node("freifunk", "luciinfo").target = call("action_index")
20 function action_index()
21 local uci = luci.model.uci
22 luci.http.prepare_content("text/plain")
25 print("luciinfo.api=1")
26 print("luciinfo.version=" .. tostring(require("luci").__version__))
29 local s, m, r = luci.sys.sysinfo()
30 local dr = luci.sys.net.defaultroute()
31 dr = dr and luci.sys.net.hexip4(dr.Gateway) or ""
32 local l1, l5, l15 = luci.sys.loadavg()
34 print("sysinfo.system=" .. sanitize(s))
35 print("sysinfo.cpu=" .. sanitize(m))
36 print("sysinfo.ram=" .. sanitize(r))
37 print("sysinfo.hostname=" .. sanitize(luci.sys.hostname()))
38 print("sysinfo.load1=" .. tostring(l1))
39 print("sysinfo.load5=" .. tostring(l5))
40 print("sysinfo.load15=" .. tostring(l15))
41 print("sysinfo.defaultgw=" .. dr)
45 local ff = uci.get_all("freifunk") or {}
46 for k, v in pairs(ff) do
47 for i, j in pairs(v) do
48 if i:sub(1, 1) ~= "." then
49 print("freifunk." .. k .. "." .. i .. "=" .. j)
55 function sanitize(val)
56 return val:gsub("\n", "\t")