generated from P3TERX/Actions-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 2
/
luci-admin-status-index-html.patch
executable file
·52 lines (44 loc) · 2.36 KB
/
luci-admin-status-index-html.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--- a/usr/lib/lua/luci/view/admin_status/index.htm 2021-06-18 10:12:55.000000000 +0800
+++ b/usr/lib/lua/luci/view/admin_status/index.htm 2021-06-18 21:36:29.348325634 +0800
@@ -17,6 +17,7 @@
local sysinfo = luci.util.ubus("system", "info") or { }
local boardinfo = luci.util.ubus("system", "board") or { }
local unameinfo = nixio.uname() or { }
+ local cpustat = luci.sys.exec("/usr/bin/cpustat") or { }
local meminfo = sysinfo.memory or {
total = 0,
@@ -43,10 +44,9 @@
fs.readfile("/proc/sys/net/netfilter/nf_conntrack_count") or "") or 0
local conn_max = tonumber(luci.sys.exec(
- "sysctl -n -e net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max"
- ):match("%d+")) or 4096
+ "sysctl -n -e net.netfilter.nf_conntrack_max net.nf_conntrack_max net.ipv4.netfilter.ip_conntrack_max | head -n 1"):match("%d+")) or 4096
- local user_info = luci.sys.exec("cat /proc/net/arp | grep 'br-lan' | grep '0x2' | wc -l")
+ local user_info = luci.sys.exec("cat /proc/net/arp | grep -E 'br-lan|eth0' | grep '0x2' | wc -l")
local cpu_usage = (luci.sys.exec("expr 100 - $(top -n 1 | grep 'CPU:' | awk -F '%' '{print$4}' | awk -F ' ' '{print$2}')") or "6") .. "%"
@@ -63,7 +63,8 @@
conncount = conn_count,
leases = stat.dhcp_leases(),
leases6 = stat.dhcp6_leases(),
- wifinets = stat.wifi_networks()
+ wifinets = stat.wifi_networks(),
+ cpustat = luci.sys.exec("/usr/bin/cpustat") or { }
}
if wan then
@@ -644,6 +645,9 @@
if (e = document.getElementById('localtime'))
e.innerHTML = info.localtime;
+ if (e = document.getElementById('cpustat'))
+ e.innerHTML = info.cpustat;
+
if (e = document.getElementById('uptime'))
e.innerHTML = String.format('%t', info.uptime);
@@ -708,6 +712,8 @@
<tr><td width="33%"><%:Kernel Version%></td><td><%=unameinfo.release or "?"%></td></tr>
<tr><td width="33%"><%:Local Time%></td><td id="localtime">-</td></tr>
<tr><td width="33%"><%:Uptime%></td><td id="uptime">-</td></tr>
+ <tr><td width="33%"><%:CPU状态%></td><td id="cpustat">-</td></tr>
<tr><td width="33%"><%:Load Average%></td><td id="loadavg">-</td></tr>
<tr><td width="33%"><%:CPU usage (%)%></td><td id="cpuusage">-</td></tr>
+ <tr><td width="33%"><%:编译作者%></td><td><a href="https://github.com/kissyouhunter/Openwrt_X86-Openwrt_N1-Armbian_N1" target="_blank">kissyouhunter</a>
</table>