diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 13:44:38 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 13:44:38 +0100 |
commit | a1f67784c9ef2a95facba658fce6ae57a795758c (patch) | |
tree | 11a61a4bc9bba69b092e28b6152c7ae55fdbc6a2 /modules/luci-mod-admin-mini | |
parent | 46beca9fb15695a5c576093bb24a88120e155972 (diff) |
luci-mod-admin-mini: remove uses of luci.sys.sysinfo()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-admin-mini')
-rw-r--r-- | modules/luci-mod-admin-mini/luasrc/model/cbi/mini/system.lua | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/system.lua b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/system.lua index 593af04f2..99392b2f9 100644 --- a/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/system.lua +++ b/modules/luci-mod-admin-mini/luasrc/model/cbi/mini/system.lua @@ -15,6 +15,7 @@ $Id$ require("luci.sys") require("luci.sys.zoneinfo") require("luci.tools.webadmin") +require("luci.util") m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone.")) @@ -24,24 +25,30 @@ s.anonymous = true s.addremove = false -local system, model, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() -local uptime = luci.sys.uptime() +local sysinfo = luci.util.ubus("system", "info") or { } +local boardinfo = luci.util.ubus("system", "board") or { } -s:option(DummyValue, "_system", translate("System")).value = model -s:option(DummyValue, "_cpu", translate("Processor")).value = system +local uptime = sysinfo.uptime or 0 +local loads = sysinfo.load or { 0, 0, 0 } +local memory = sysinfo.memory or { + total = 0, + free = 0, + buffered = 0, + shared = 0 +} + +s:option(DummyValue, "_system", translate("Model")).value = boardinfo.model or "?" +s:option(DummyValue, "_cpu", translate("System")).value = boardinfo.system or "?" -local load1, load5, load15 = luci.sys.loadavg() s:option(DummyValue, "_la", translate("Load")).value = - string.format("%.2f, %.2f, %.2f", load1, load5, load15) + string.format("%.2f, %.2f, %.2f", loads[1] / 65535.0, loads[2] / 65535.0, loads[3] / 65535.0) s:option(DummyValue, "_memtotal", translate("Memory")).value = - string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)", - tonumber(memtotal) / 1024, - 100 * memcached / memtotal, - tostring(translate("cached")), - 100 * membuffers / memtotal, + string.format("%.2f MB (%.0f%% %s, %.0f%% %s)", + tonumber(memory.total) / 1024 / 1024, + 100 * memory.buffered / memory.total, tostring(translate("buffered")), - 100 * memfree / memtotal, + 100 * memory.free / memory.total, tostring(translate("free")) ) |