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
15 require("luci.tools.webadmin")
17 w = Template("mini/index")
19 f = SimpleForm("main", translate("system"))
23 local system, model, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo()
24 local uptime = luci.sys.uptime()
25 f:field(DummyValue, "_system", translate("system")).value = system
26 f:field(DummyValue, "_cpu", translate("m_i_processor")).value = model
28 local load1, load5, load15 = luci.sys.loadavg()
29 f:field(DummyValue, "_la", translate("load")).value =
30 string.format("%.2f, %.2f, %.2f", load1, load5, load15)
32 f:field(DummyValue, "_memtotal", translate("m_i_memory")).value =
33 string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)",
34 tonumber(memtotal) / 1024,
35 100 * memcached / memtotal,
36 translate("mem_cached") or "",
37 100 * membuffers / memtotal,
38 translate("mem_buffered") or "",
39 100 * memfree / memtotal,
40 translate("mem_free") or "")
42 f:field(DummyValue, "_systime", translate("m_i_systemtime")).value =
45 f:field(DummyValue, "_uptime", translate("m_i_uptime")).value =
46 luci.tools.webadmin.date_format(tonumber(uptime))