summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-01-15 14:26:36 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-15 14:26:36 +0100
commit76eb057b2c06af6d2f0c9278877131f3c3e1f250 (patch)
treebac9c58b2a7a695e67c364dd4987d392ad4ea064 /modules/luci-base/luasrc
parentbfbc7f4bdf6b60edf9d52d995c14d156d8349757 (diff)
luci-mod-base: drop luci.sys.sysinfo() and luci.sys.loadavg()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-base/luasrc')
-rw-r--r--modules/luci-base/luasrc/sys.lua47
1 files changed, 0 insertions, 47 deletions
diff --git a/modules/luci-base/luasrc/sys.lua b/modules/luci-base/luasrc/sys.lua
index 3a04f6bad..292cc9667 100644
--- a/modules/luci-base/luasrc/sys.lua
+++ b/modules/luci-base/luasrc/sys.lua
@@ -144,59 +144,12 @@ function httpget(url, stream, target)
end
end
---- Returns the system load average values.
--- @return String containing the average load value 1 minute ago
--- @return String containing the average load value 5 minutes ago
--- @return String containing the average load value 15 minutes ago
-function loadavg()
- local info = nixio.sysinfo()
- return info.loads[1], info.loads[2], info.loads[3]
-end
-
--- Initiate a system reboot.
-- @return Return value of os.execute()
function reboot()
return os.execute("reboot >/dev/null 2>&1")
end
---- Returns the system type, cpu name and installed physical memory.
--- @return String containing the system or platform identifier
--- @return String containing hardware model information
--- @return String containing the total memory amount in kB
--- @return String containing the memory used for caching in kB
--- @return String containing the memory used for buffering in kB
--- @return String containing the free memory amount in kB
--- @return String containing the cpu bogomips (number)
-function sysinfo()
- local cpuinfo = fs.readfile("/proc/cpuinfo")
- local meminfo = fs.readfile("/proc/meminfo")
-
- local memtotal = tonumber(meminfo:match("MemTotal:%s*(%d+)"))
- local memcached = tonumber(meminfo:match("\nCached:%s*(%d+)"))
- local memfree = tonumber(meminfo:match("MemFree:%s*(%d+)"))
- local membuffers = tonumber(meminfo:match("Buffers:%s*(%d+)"))
- local bogomips = tonumber(cpuinfo:match("[Bb]ogo[Mm][Ii][Pp][Ss].-: ([^\n]+)")) or 0
- local swaptotal = tonumber(meminfo:match("SwapTotal:%s*(%d+)"))
- local swapcached = tonumber(meminfo:match("SwapCached:%s*(%d+)"))
- local swapfree = tonumber(meminfo:match("SwapFree:%s*(%d+)"))
-
- local system =
- cpuinfo:match("system type\t+: ([^\n]+)") or
- cpuinfo:match("Processor\t+: ([^\n]+)") or
- cpuinfo:match("model name\t+: ([^\n]+)")
-
- local model =
- fs.readfile("/proc/device-tree/model") or
- luci.util.pcdata(fs.readfile("/tmp/sysinfo/model")) or
- cpuinfo:match("machine\t+: ([^\n]+)") or
- cpuinfo:match("Hardware\t+: ([^\n]+)") or
- luci.util.pcdata(fs.readfile("/proc/diag/model")) or
- nixio.uname().machine or
- system
-
- return system, model, memtotal, memcached, membuffers, memfree, bogomips, swaptotal, swapcached, swapfree
-end
-
--- Retrieves the output of the "logread" command.
-- @return String containing the current log buffer
function syslog()