luci-mod-base: drop luci.sys.sysinfo() and luci.sys.loadavg()
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Jan 2015 13:26:36 +0000 (14:26 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 15 Jan 2015 13:26:36 +0000 (14:26 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/luci-base/luasrc/sys.lua

index 3a04f6b..292cc96 100644 (file)
@@ -144,59 +144,12 @@ function httpget(url, stream, target)
        end
 end
 
        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
 
 --- 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()
 --- Retrieves the output of the "logread" command.
 -- @return     String containing the current log buffer
 function syslog()