feat(webui,dashboard): add RAM Usage card between Disk Usage and Uptime, live-verified on Pager

This commit is contained in:
c4ch3c4d3
2026-08-24 18:12:32 -06:00
parent e683691a53
commit 18bd6e3f9a
3 changed files with 37 additions and 2 deletions
@@ -3025,6 +3025,23 @@ def disk_data():
return {}
def mem_data(path='/proc/meminfo'):
try:
vals = {}
with open(path) as f:
for line in f:
k, v = line.split(':')
vals[k] = int(v.strip().split()[0])
total = vals.get('MemTotal', 0)
avail = vals.get('MemAvailable', vals.get('MemFree', 0))
if not total:
return {}
used = max(total - avail, 0)
return {'size': total * 1024, 'used': used * 1024, 'avail': avail * 1024}
except (OSError, ValueError):
return {}
def uptime_data():
rc, out, err = device_run(['cat', '/proc/uptime'])
try:
@@ -3066,6 +3083,7 @@ def status_data():
'wifi': [wifi_iface_info(n) for n in ifaces],
'clients': assoc_clients(ifaces),
'disk': disk_data(),
'mem': mem_data(),
'uptime': uptime_data(),
'hostname': hostname_data(),
}