|
15 | 15 | local has_dhcp = fs.access("/etc/config/dhcp") |
16 | 16 | local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) |
17 | 17 | local has_switch = false |
18 | | - |
| 18 | + |
19 | 19 | uci:foreach("network", "switch", |
20 | 20 | function(s) |
21 | 21 | has_switch = true |
|
32 | 32 | buffered = 0, |
33 | 33 | shared = 0 |
34 | 34 | } |
35 | | - |
| 35 | + |
36 | 36 | local mem_cached = luci.sys.exec("sed -e '/^Cached: /!d; s#Cached: *##; s# kB##g' /proc/meminfo") |
37 | 37 |
|
38 | 38 | local swapinfo = sysinfo.swap or { |
|
56 | 56 |
|
57 | 57 | local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l") |
58 | 58 |
|
59 | | - local cpu_usage = luci.sys.exec("top -n1 | awk '/^CPU/ { printf(\"%d%%\", 100 - $8) }'") or "6%" |
60 | | - local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "ARM Processor x 0 (233MHz, 2.3°C)" |
| 59 | + local cpu_usage = luci.sys.exec("/sbin/usage") or "6%" |
| 60 | + local cpu_info = luci.sys.exec("/sbin/cpuinfo") or "?" |
61 | 61 | local eth_info = luci.sys.exec("ethinfo") |
62 | 62 |
|
63 | 63 | local rv = { |
|
162 | 162 | if (ht) s += ', MCS %s'.format(mcs); |
163 | 163 | if (sgi) s += ', <%:Short GI%>'; |
164 | 164 | } |
165 | | - |
| 165 | + |
166 | 166 | if (he) { |
167 | 167 | s += ', HE-MCS %d'.format(mcs); |
168 | 168 | if (nss) s += ', HE-NSS %d'.format(nss); |
|
265 | 265 | '<strong><%:Type%>: </strong>%s%s<br />', |
266 | 266 | ifc6.proto, (ifc6.ip6prefix) ? '-pd' : '' |
267 | 267 | ); |
268 | | - |
| 268 | + |
269 | 269 | if (!ifc6.ip6prefix) |
270 | 270 | { |
271 | 271 | s += String.format( |
|
652 | 652 | <% end %> |
653 | 653 |
|
654 | 654 | var e; |
655 | | - |
| 655 | + |
656 | 656 | if (e = document.getElementById('ethinfo')) { |
657 | 657 | var ports = eval('(' + info.ethinfo + ')'); |
658 | 658 | var tmp = ""; |
|
672 | 672 |
|
673 | 673 | if (e = document.getElementById('uptime')) |
674 | 674 | e.innerHTML = String.format('%t', info.uptime); |
675 | | - |
| 675 | + |
676 | 676 | if (e = document.getElementById('userinfo')) |
677 | 677 | e.innerHTML = info.userinfo; |
678 | | - |
| 678 | + |
679 | 679 | if (e = document.getElementById('cpuusage')) |
680 | 680 | e.innerHTML = info.cpuusage; |
681 | 681 |
|
|
0 commit comments