Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d53c616f34 | ||
|
|
392f6a737c | ||
|
|
1aff3138cb | ||
|
|
f417f8b01a | ||
|
|
133959ef74 | ||
|
|
e7ee434306 | ||
|
|
02cbda07e1 | ||
|
|
214a62d872 | ||
|
|
9849be2ab2 | ||
|
|
78c16f9f3e | ||
|
|
573b0c5a24 | ||
|
|
7fd72e2106 | ||
|
|
1d4fc7a691 | ||
|
|
0624129c2a | ||
|
|
bb7101af67 | ||
|
|
ec38cd80e0 | ||
|
|
f5ad6babc2 | ||
|
|
555d8839e7 | ||
|
|
497510c32b | ||
|
|
a430e3a791 | ||
|
|
eab6475199 |
No files matched your search
@@ -1,5 +1,6 @@
|
|||||||
from flask import Flask, jsonify, request, send_from_directory
|
from flask import Flask, jsonify, request, send_from_directory
|
||||||
import psutil, os, time, signal, threading, subprocess, platform, glob, json, struct
|
import psutil, os, time, signal, threading, subprocess, platform, glob, json, struct
|
||||||
|
import hashlib, random, urllib.request, urllib.parse
|
||||||
try:
|
try:
|
||||||
psutil.PROCFS_PATH = os.environ.get("PROCFS_PATH", "/proc")
|
psutil.PROCFS_PATH = os.environ.get("PROCFS_PATH", "/proc")
|
||||||
except Exception:
|
except Exception:
|
||||||
@@ -12,6 +13,114 @@ if os.path.isdir(PROCFS):
|
|||||||
app = Flask(__name__, static_folder="public", static_url_path="")
|
app = Flask(__name__, static_folder="public", static_url_path="")
|
||||||
PORT = int(os.environ.get("PORT", "7031"))
|
PORT = int(os.environ.get("PORT", "7031"))
|
||||||
|
|
||||||
|
# ---------- CardAuth hub (免费形态: 安装统计/在线/公告/版本推送,失败开放) ----------
|
||||||
|
HUB_URL = os.environ.get("HUB_URL", "https://auth.88531.cn/api").rstrip("/")
|
||||||
|
HUB_PROJECT_ID = os.environ.get("HUB_PROJECT_ID", "12")
|
||||||
|
HUB_VERSION = os.environ.get("SITE_VERSION", "1.3.15")
|
||||||
|
HUB = {"ok": False, "install_id": None, "latest": "", "update_available": False,
|
||||||
|
"update_required": False, "download_url": "", "changelog": "",
|
||||||
|
"announcements": [], "popup": [], "ts": 0}
|
||||||
|
|
||||||
|
def _hub_key():
|
||||||
|
try:
|
||||||
|
kf = os.environ.get("HUB_KEY_FILE", "")
|
||||||
|
if kf and os.path.exists(kf):
|
||||||
|
with open(kf) as f:
|
||||||
|
k = f.read().strip()
|
||||||
|
if k:
|
||||||
|
return k
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return os.environ.get("HUB_API_KEY", "").strip()
|
||||||
|
|
||||||
|
def _machine_id():
|
||||||
|
raw = ""
|
||||||
|
for p in ("/host/etc/machine-id", "/etc/machine-id"):
|
||||||
|
try:
|
||||||
|
with open(p) as f:
|
||||||
|
raw = f.read().strip()
|
||||||
|
if raw:
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
if not raw:
|
||||||
|
try:
|
||||||
|
raw = open("/proc/sys/kernel/random/uuid").read().strip()
|
||||||
|
except Exception:
|
||||||
|
raw = str(time.time())
|
||||||
|
h = hashlib.sha256(("fnos-resmon-12-" + raw).encode()).hexdigest()
|
||||||
|
return str(int(h[:15], 16) % 10**16).zfill(16)[:16]
|
||||||
|
|
||||||
|
def _hub_post(path, body):
|
||||||
|
key = _hub_key()
|
||||||
|
if not key:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
req = urllib.request.Request(
|
||||||
|
HUB_URL + path, data=json.dumps(body).encode(),
|
||||||
|
headers={"Content-Type": "application/json", "X-Api-Key": key,
|
||||||
|
"X-Project-Id": HUB_PROJECT_ID}, method="POST")
|
||||||
|
with urllib.request.urlopen(req, timeout=8) as r:
|
||||||
|
j = json.loads(r.read().decode())
|
||||||
|
return j if j.get("code") == 200 else None
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _hub_get_ann():
|
||||||
|
try:
|
||||||
|
u = (HUB_URL + "/public/announcements?target=client&project_id="
|
||||||
|
+ urllib.parse.quote(HUB_PROJECT_ID) + "&limit=20")
|
||||||
|
with urllib.request.urlopen(urllib.request.Request(u), timeout=8) as r:
|
||||||
|
j = json.loads(r.read().decode())
|
||||||
|
if j.get("code") != 200:
|
||||||
|
return None
|
||||||
|
d = j.get("data") or {}
|
||||||
|
items = d.get("list", []) or []
|
||||||
|
out = [a for a in items
|
||||||
|
if a.get("project_id") is None or str(a.get("project_id")) == str(HUB_PROJECT_ID)]
|
||||||
|
return {"all": out, "popup": d.get("popup", []) or []}
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def _hub_loop():
|
||||||
|
mid = _machine_id()
|
||||||
|
last_hb, last_cu = 0, 0
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
now = time.time()
|
||||||
|
if now - last_cu >= 6 * 3600:
|
||||||
|
r = _hub_post("/public/installations/check-update",
|
||||||
|
{"machine_id": mid, "client_version": HUB_VERSION,
|
||||||
|
"device_info": "fnos-resmon/docker"})
|
||||||
|
if r:
|
||||||
|
d = r.get("data") or {}
|
||||||
|
HUB.update(ok=True, install_id=d.get("install_id"),
|
||||||
|
latest=d.get("latest_version") or "",
|
||||||
|
update_available=bool(d.get("update_available")),
|
||||||
|
update_required=bool(d.get("update_required")),
|
||||||
|
download_url=d.get("download_url") or "",
|
||||||
|
changelog=d.get("changelog") or "")
|
||||||
|
last_cu = now
|
||||||
|
if now - last_hb >= 30 * 60:
|
||||||
|
r = _hub_post("/public/installations/heartbeat", {"machine_id": mid})
|
||||||
|
if r:
|
||||||
|
HUB["ok"] = True
|
||||||
|
iid = (r.get("data") or {}).get("install_id")
|
||||||
|
if iid:
|
||||||
|
HUB["install_id"] = iid
|
||||||
|
last_hb = now
|
||||||
|
a = _hub_get_ann()
|
||||||
|
if a is not None:
|
||||||
|
HUB["announcements"] = a["all"]
|
||||||
|
HUB["popup"] = a["popup"]
|
||||||
|
HUB["ok"] = True
|
||||||
|
HUB["ts"] = now
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
time.sleep(60)
|
||||||
|
|
||||||
|
threading.Thread(target=_hub_loop, daemon=True).start()
|
||||||
|
|
||||||
# ---------- host netns helpers (桥接模式用) ----------
|
# ---------- host netns helpers (桥接模式用) ----------
|
||||||
# 容器切桥接后,直读 /proc/net 只能看到容器自身 netns。
|
# 容器切桥接后,直读 /proc/net 只能看到容器自身 netns。
|
||||||
# 网络类数据统一经 nsenter 进入宿主(PID 1) netns 读取,保证与 host 模式一致。
|
# 网络类数据统一经 nsenter 进入宿主(PID 1) netns 读取,保证与 host 模式一致。
|
||||||
@@ -265,6 +374,7 @@ def api_cpu():
|
|||||||
return jsonify({"cpu": cache["cpu"], "load": cache["load"],
|
return jsonify({"cpu": cache["cpu"], "load": cache["load"],
|
||||||
"active": active, "total": len(cache["procs"]),
|
"active": active, "total": len(cache["procs"]),
|
||||||
"info": get_cpu_info(), "percpu": get_percpu(),
|
"info": get_cpu_info(), "percpu": get_percpu(),
|
||||||
|
"mhz": get_percpu_mhz(),
|
||||||
"items": cache["procs"][:100]})
|
"items": cache["procs"][:100]})
|
||||||
|
|
||||||
_cpu_static = {}
|
_cpu_static = {}
|
||||||
@@ -354,6 +464,278 @@ def get_percpu():
|
|||||||
except Exception:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
def get_percpu_mhz():
|
||||||
|
"""每核实时频率(MHz): 优先读 cpufreq scaling_cur_freq,读不到回退 cpuinfo"""
|
||||||
|
mhz = []
|
||||||
|
try:
|
||||||
|
paths = sorted(glob.glob("/sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_cur_freq"))
|
||||||
|
if not paths:
|
||||||
|
for base in ("/host/sys/devices/system/cpu", "/sys/devices/system/cpu"):
|
||||||
|
try:
|
||||||
|
names = sorted([d for d in os.listdir(base) if d.startswith("cpu") and d[3:].isdigit()])
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
for n in names:
|
||||||
|
paths.append(os.path.join(base, n, "cpufreq/scaling_cur_freq"))
|
||||||
|
if paths:
|
||||||
|
break
|
||||||
|
for p in paths:
|
||||||
|
try:
|
||||||
|
with open(p) as f:
|
||||||
|
v = float(f.read().strip())
|
||||||
|
mhz.append(int(round(v / 1000.0)))
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if not mhz:
|
||||||
|
try:
|
||||||
|
for cp in ("/host/proc/cpuinfo", "/proc/cpuinfo"):
|
||||||
|
try:
|
||||||
|
vals = []
|
||||||
|
with open(cp) as f:
|
||||||
|
for line in f:
|
||||||
|
if line.startswith("cpu MHz"):
|
||||||
|
vals.append(int(round(float(line.split(":")[1].strip()))))
|
||||||
|
if vals:
|
||||||
|
mhz = vals
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return mhz
|
||||||
|
|
||||||
|
# ---------- 各页测速: CPU/内存/硬盘/网络(非破坏,失败返回error) ----------
|
||||||
|
import urllib.request as _urlreq
|
||||||
|
|
||||||
|
def _bench_cpu():
|
||||||
|
import math
|
||||||
|
N = 200000
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
x = 0
|
||||||
|
for i in range(N):
|
||||||
|
x += (i * i) % 10007
|
||||||
|
dt = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
return {"ms": int(round(dt * 1000)), "kops": int(round(N / dt / 1000)),
|
||||||
|
"score": int(round(N / dt / 1000)), "detail": "20万次整数运算耗时"}
|
||||||
|
|
||||||
|
def _bench_mem():
|
||||||
|
SZ = 32 * 1024 * 1024
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
b = bytearray(SZ)
|
||||||
|
b[:] = b"\x5a" * SZ
|
||||||
|
dt_w = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
s = sum(b[::4096])
|
||||||
|
dt_r = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
del b
|
||||||
|
return {"write_mbs": round(SZ / dt_w / 1048576, 1),
|
||||||
|
"read_mbs": round(SZ / dt_r / 1048576, 1),
|
||||||
|
"size_mb": 32, "detail": "32MB 内存写/读", "checksum": s % 997}
|
||||||
|
|
||||||
|
def _bench_disk():
|
||||||
|
SZ_MB = 32
|
||||||
|
data = os.urandom(4 * 1024 * 1024)
|
||||||
|
path = ""
|
||||||
|
for cand in ("/host/vol1/.fnos_resmon_bench.tmp",
|
||||||
|
"/host/.fnos_resmon_bench.tmp", "/tmp/.fnos_resmon_bench.tmp"):
|
||||||
|
try:
|
||||||
|
d = os.path.dirname(cand)
|
||||||
|
if os.path.isdir(d) and os.access(d, os.W_OK):
|
||||||
|
path = cand
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
if not path:
|
||||||
|
return {"ok": False, "error": "无可写目录"}
|
||||||
|
try:
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
with open(path, "wb") as f:
|
||||||
|
for _ in range(SZ_MB // 4):
|
||||||
|
f.write(data)
|
||||||
|
f.flush()
|
||||||
|
os.fsync(f.fileno())
|
||||||
|
dt_w = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
with open(path, "rb") as f:
|
||||||
|
while f.read(4 * 1024 * 1024):
|
||||||
|
pass
|
||||||
|
dt_r = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
return {"write_mbs": round(SZ_MB / dt_w, 1),
|
||||||
|
"read_mbs": round(SZ_MB / dt_r, 1),
|
||||||
|
"size_mb": SZ_MB, "file": path.replace("/host", "") or "/",
|
||||||
|
"detail": "32MB 文件写(含落盘)/读"}
|
||||||
|
except Exception as e:
|
||||||
|
return {"ok": False, "error": str(e)}
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
os.unlink(path)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def _bench_net():
|
||||||
|
out = {}
|
||||||
|
try:
|
||||||
|
url = "https://speed.cloudflare.com/__down?bytes=5000000"
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
req = _urlreq.Request(url, headers={"User-Agent": "fnos-resmon"})
|
||||||
|
with _urlreq.urlopen(req, timeout=25) as r:
|
||||||
|
n = 0
|
||||||
|
while True:
|
||||||
|
ch = r.read(256 * 1024)
|
||||||
|
if not ch:
|
||||||
|
break
|
||||||
|
n += len(ch)
|
||||||
|
dt = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
out["down_mbps"] = round(n * 8 / dt / 1000000, 1)
|
||||||
|
out["down_mb"] = round(n / 1048576, 1)
|
||||||
|
out["down_s"] = round(dt, 1)
|
||||||
|
except Exception as e:
|
||||||
|
return {"ok": False, "error": "下载测速失败: %s" % e}
|
||||||
|
try:
|
||||||
|
payload = os.urandom(2 * 1024 * 1024)
|
||||||
|
t0 = time.perf_counter()
|
||||||
|
req = _urlreq.Request("https://speed.cloudflare.com/__up",
|
||||||
|
data=payload, method="POST",
|
||||||
|
headers={"Content-Type": "application/octet-stream",
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"})
|
||||||
|
with _urlreq.urlopen(req, timeout=25) as r:
|
||||||
|
r.read()
|
||||||
|
dt = max(time.perf_counter() - t0, 1e-6)
|
||||||
|
out["up_mbps"] = round(len(payload) * 8 / dt / 1000000, 1)
|
||||||
|
out["up_mb"] = round(len(payload) / 1048576, 1)
|
||||||
|
out["up_s"] = round(dt, 1)
|
||||||
|
except Exception as e:
|
||||||
|
out["up_mbps"] = 0
|
||||||
|
out["up_error"] = "上传测速失败: %s" % e
|
||||||
|
out.update({"ok": True, "detail": "Cloudflare 测速点: 下行5MB/上行2MB"})
|
||||||
|
return out
|
||||||
|
|
||||||
|
@app.route("/api/bench/<kind>", methods=["POST"])
|
||||||
|
def api_bench(kind):
|
||||||
|
try:
|
||||||
|
if kind == "cpu":
|
||||||
|
r = _bench_cpu()
|
||||||
|
p = _read_perf()
|
||||||
|
r.update({"ok": True, "mode": p.get("mode", ""),
|
||||||
|
"governor": p.get("governor", ""), "epp": p.get("epp", ""),
|
||||||
|
"mhz_avg": (sum(get_percpu_mhz()) // len(get_percpu_mhz()) if get_percpu_mhz() else 0)})
|
||||||
|
elif kind == "mem":
|
||||||
|
r = _bench_mem()
|
||||||
|
r["ok"] = True
|
||||||
|
elif kind == "disk":
|
||||||
|
r = _bench_disk()
|
||||||
|
if "ok" not in r:
|
||||||
|
r["ok"] = True
|
||||||
|
elif kind == "net":
|
||||||
|
r = _bench_net()
|
||||||
|
else:
|
||||||
|
return jsonify({"ok": False, "error": "未知测速类型"}), 400
|
||||||
|
r["at"] = time.strftime("%m-%d %H:%M:%S", time.localtime())
|
||||||
|
return jsonify(r)
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({"ok": False, "error": str(e)}), 500
|
||||||
|
|
||||||
|
# ---------- CPU 性能模式: 省电/平衡/高性能(写宿主 cpufreq,失败开放) ----------
|
||||||
|
PERF_FILE = os.environ.get("PERF_FILE", "/run/secrets/perf_mode.json")
|
||||||
|
PERF_FILE_FALLBACKS = [PERF_FILE, "/app/perf_mode.json"]
|
||||||
|
PERF_MODES = {
|
||||||
|
"powersave": {"governor": "powersave", "epp": "power",
|
||||||
|
"name": "省电模式"},
|
||||||
|
"balanced": {"governor": "powersave", "epp": "balance_performance",
|
||||||
|
"name": "平衡模式"},
|
||||||
|
"performance": {"governor": "performance", "epp": "performance",
|
||||||
|
"name": "高性能模式"},
|
||||||
|
}
|
||||||
|
|
||||||
|
def _saved_perf_mode():
|
||||||
|
for p in PERF_FILE_FALLBACKS:
|
||||||
|
try:
|
||||||
|
with open(p) as f:
|
||||||
|
m = (json.load(f) or {}).get("mode", "")
|
||||||
|
if m in PERF_MODES:
|
||||||
|
return m
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def _read_perf():
|
||||||
|
gov, epp = "", ""
|
||||||
|
try:
|
||||||
|
with open("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor") as f:
|
||||||
|
gov = f.read().strip()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
with open("/sys/devices/system/cpu/cpufreq/policy0/energy_performance_preference") as f:
|
||||||
|
epp = f.read().strip().split()[0]
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
mode = ""
|
||||||
|
for k, v in PERF_MODES.items():
|
||||||
|
if v["governor"] == gov and (not epp or v["epp"] == epp):
|
||||||
|
mode = k
|
||||||
|
break
|
||||||
|
return {"governor": gov, "epp": epp, "mode": mode,
|
||||||
|
"saved": _saved_perf_mode()}
|
||||||
|
|
||||||
|
def _apply_perf(mode):
|
||||||
|
if mode not in PERF_MODES:
|
||||||
|
return {"ok": False, "error": "未知模式"}
|
||||||
|
want = PERF_MODES[mode]
|
||||||
|
ok_g = fail_g = ok_e = fail_e = 0
|
||||||
|
for p in sorted(glob.glob("/sys/devices/system/cpu/cpu[0-9]*/cpufreq/scaling_governor")):
|
||||||
|
try:
|
||||||
|
with open(p, "w") as f:
|
||||||
|
f.write(want["governor"])
|
||||||
|
ok_g += 1
|
||||||
|
except Exception:
|
||||||
|
fail_g += 1
|
||||||
|
for p in sorted(glob.glob("/sys/devices/system/cpu/cpufreq/policy*/energy_performance_preference")):
|
||||||
|
try:
|
||||||
|
with open(p, "w") as f:
|
||||||
|
f.write(want["epp"])
|
||||||
|
ok_e += 1
|
||||||
|
except Exception:
|
||||||
|
fail_e += 1
|
||||||
|
if ok_g == 0 and fail_g > 0:
|
||||||
|
return {"ok": False, "error": "调频接口不可写( governor 写入失败 )"}
|
||||||
|
try:
|
||||||
|
with open(PERF_FILE, "w") as f:
|
||||||
|
json.dump({"mode": mode}, f)
|
||||||
|
except Exception:
|
||||||
|
try:
|
||||||
|
with open("/app/perf_mode.json", "w") as f:
|
||||||
|
json.dump({"mode": mode}, f)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
st = _read_perf()
|
||||||
|
st.update({"ok": True, "mode": mode, "gov_ok": ok_g, "gov_fail": fail_g,
|
||||||
|
"epp_ok": ok_e, "epp_fail": fail_e,
|
||||||
|
"msg": "已切换为%s,立即生效,不重启电脑" % want["name"]})
|
||||||
|
return st
|
||||||
|
|
||||||
|
@app.route("/api/cpu/perf")
|
||||||
|
def api_cpu_perf():
|
||||||
|
return jsonify(_read_perf())
|
||||||
|
|
||||||
|
@app.route("/api/cpu/perf", methods=["POST"])
|
||||||
|
def api_cpu_perf_set():
|
||||||
|
try:
|
||||||
|
mode = (request.get_json(force=True, silent=True) or {}).get("mode", "")
|
||||||
|
except Exception:
|
||||||
|
mode = ""
|
||||||
|
r = _apply_perf(mode)
|
||||||
|
return jsonify(r), (200 if r.get("ok") else 400)
|
||||||
|
|
||||||
|
try:
|
||||||
|
_sv = _saved_perf_mode()
|
||||||
|
if _sv:
|
||||||
|
_apply_perf(_sv)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
@app.route("/api/mem")
|
@app.route("/api/mem")
|
||||||
def api_mem():
|
def api_mem():
|
||||||
vm = psutil.virtual_memory()
|
vm = psutil.virtual_memory()
|
||||||
@@ -558,6 +940,186 @@ def _df_host():
|
|||||||
except Exception:
|
except Exception:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@app.route("/api/cpu/advise")
|
||||||
|
def api_cpu_advise():
|
||||||
|
"""负载诊断:档位结论 + 能否顶住 + 优化建议"""
|
||||||
|
try:
|
||||||
|
load = list(os.getloadavg())
|
||||||
|
except Exception:
|
||||||
|
load = [0, 0, 0]
|
||||||
|
try:
|
||||||
|
cpu_pct = psutil.cpu_percent(interval=None)
|
||||||
|
except Exception:
|
||||||
|
cpu_pct = 0
|
||||||
|
try:
|
||||||
|
vm = psutil.virtual_memory()
|
||||||
|
except Exception:
|
||||||
|
vm = None
|
||||||
|
logical = psutil.cpu_count() or 1
|
||||||
|
l1 = load[0]
|
||||||
|
per_core = l1 / logical
|
||||||
|
if per_core < 0.5 and (cpu_pct or 0) < 50:
|
||||||
|
level, verdict = "轻松", "✅ 当前配置完全顶得住,负载很轻,还有大量余量。"
|
||||||
|
elif per_core < 0.8 and (cpu_pct or 0) < 75:
|
||||||
|
level, verdict = "正常", "✅ 当前配置顶得住,负载正常,日常使用流畅。"
|
||||||
|
elif per_core < 1.0 and (cpu_pct or 0) < 90:
|
||||||
|
level, verdict = "偏高", "⚠️ 当前配置勉强顶住,高峰期可能卡顿,建议按下面方法优化。"
|
||||||
|
else:
|
||||||
|
level, verdict = "过载", "🔴 当前配置顶不住了!负载已超过 CPU 承受能力,请立即优化或升级。"
|
||||||
|
tips = []
|
||||||
|
tops = sorted(cache.get("procs", []), key=lambda x: x.get("cpu", 0), reverse=True)[:3]
|
||||||
|
if tops and (tops[0].get("cpu") or 0) > 50:
|
||||||
|
tips.append("🎯 头号吃CPU进程是 %s(占用 %s%%,PID %s),如非必需请结束它,效果最明显。" % (
|
||||||
|
tops[0].get("name"), tops[0].get("cpu"), tops[0].get("pid")))
|
||||||
|
if vm is not None and vm.percent > 85:
|
||||||
|
tips.append("💾 内存已用 %s%%,内存不足会拖慢 CPU(频繁 swap)。先点内存页「一键回收」,或加内存条。" % vm.percent)
|
||||||
|
tips.append("🧹 点下方「一键优化系统」:自动数据落盘 + 回收内存缓存,约20秒见效。")
|
||||||
|
tips.append("📦 精简开机自启与常驻 Docker 容器,不用的先停掉(docker stop),负载立降。")
|
||||||
|
tips.append("🌡️ 检查散热:CPU 过热会自动降频,清理灰尘、保证通风,频率上去了自然流畅。")
|
||||||
|
return jsonify({"load": [round(x, 2) for x in load], "cpu": round(cpu_pct or 0, 1),
|
||||||
|
"logical": logical, "per_core": round(per_core, 2),
|
||||||
|
"level": level, "verdict": verdict, "tips": tips,
|
||||||
|
"top_cpu": [{"name": t.get("name"), "cpu": t.get("cpu"), "pid": t.get("pid")} for t in tops]})
|
||||||
|
|
||||||
|
_OPT_JOB = {"running": False, "done": False, "cancelled": False, "cancel": False,
|
||||||
|
"steps": [], "freed": 0, "available": 0, "started": 0}
|
||||||
|
|
||||||
|
def _optimize_worker():
|
||||||
|
job = _OPT_JOB
|
||||||
|
steps = []
|
||||||
|
try:
|
||||||
|
before_mem = psutil.virtual_memory().available
|
||||||
|
except Exception:
|
||||||
|
before_mem = 0
|
||||||
|
try:
|
||||||
|
subprocess.run(["sync"], check=False, timeout=20)
|
||||||
|
steps.append("数据落盘(sync)完成")
|
||||||
|
except Exception as e:
|
||||||
|
steps.append("数据落盘跳过: %s" % e)
|
||||||
|
if job.get("cancel"):
|
||||||
|
job["steps"] = steps + ["已手动停止,后续步骤取消"]
|
||||||
|
job["cancelled"] = True
|
||||||
|
job["done"] = False
|
||||||
|
job["running"] = False
|
||||||
|
job["cancel"] = False
|
||||||
|
try:
|
||||||
|
job["available"] = psutil.virtual_memory().available
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
p = os.environ.get("PROCFS_PATH", "/proc")
|
||||||
|
with open(os.path.join(p, "sys", "vm", "drop_caches"), "w") as f:
|
||||||
|
f.write("3")
|
||||||
|
steps.append("内存缓存已回收(drop caches)")
|
||||||
|
except Exception as e:
|
||||||
|
steps.append("缓存回收跳过: %s" % e)
|
||||||
|
try:
|
||||||
|
after_mem = psutil.virtual_memory().available
|
||||||
|
except Exception:
|
||||||
|
after_mem = 0
|
||||||
|
job["steps"] = steps
|
||||||
|
job["freed"] = max(0, after_mem - before_mem)
|
||||||
|
job["available"] = after_mem
|
||||||
|
job["done"] = True
|
||||||
|
job["cancelled"] = False
|
||||||
|
job["running"] = False
|
||||||
|
|
||||||
|
@app.route("/api/sys/optimize", methods=["POST"])
|
||||||
|
def api_sys_optimize():
|
||||||
|
"""一键优化系统: 后台线程做 sync + drop caches,不阻塞监控轮询.
|
||||||
|
已去掉 compact_memory(大内存下会卡住数分钟,正是之前掉线的原因)"""
|
||||||
|
if _OPT_JOB.get("running"):
|
||||||
|
return jsonify({"ok": False, "running": True,
|
||||||
|
"msg": "优化正在进行中,请稍候"}), 409
|
||||||
|
_OPT_JOB.update({"running": True, "done": False, "cancelled": False, "cancel": False,
|
||||||
|
"steps": [], "freed": 0, "available": 0, "started": time.time()})
|
||||||
|
threading.Thread(target=_optimize_worker, daemon=True).start()
|
||||||
|
return jsonify({"ok": True, "started": True, "eta": 20})
|
||||||
|
|
||||||
|
@app.route("/api/sys/optimize/cancel", methods=["POST"])
|
||||||
|
def api_sys_optimize_cancel():
|
||||||
|
"""停止优化: 置取消标记,worker 在步骤间隙退出,不阻塞"""
|
||||||
|
if not _OPT_JOB.get("running"):
|
||||||
|
return jsonify({"ok": False, "msg": "当前没有正在进行的优化"})
|
||||||
|
_OPT_JOB["cancel"] = True
|
||||||
|
return jsonify({"ok": True, "msg": "已发送停止信号"})
|
||||||
|
|
||||||
|
@app.route("/api/sys/optimize/status")
|
||||||
|
def api_sys_optimize_status():
|
||||||
|
job = _OPT_JOB
|
||||||
|
try:
|
||||||
|
elapsed = round(time.time() - job.get("started", 0), 1) if job.get("started") else 0
|
||||||
|
except Exception:
|
||||||
|
elapsed = 0
|
||||||
|
return jsonify({"running": job.get("running", False),
|
||||||
|
"done": job.get("done", False),
|
||||||
|
"cancelled": job.get("cancelled", False),
|
||||||
|
"steps": job.get("steps", []),
|
||||||
|
"freed": job.get("freed", 0),
|
||||||
|
"available": job.get("available", 0),
|
||||||
|
"elapsed": elapsed})
|
||||||
|
|
||||||
|
@app.route("/api/sensors")
|
||||||
|
def api_sensors():
|
||||||
|
"""CPU温度/风扇转速: 优先读宿主 /host/sys hwmon,读不到返回空+提示"""
|
||||||
|
temps, fans = [], []
|
||||||
|
HWMON_LABEL = {"k10temp": "CPU", "zenpower": "CPU", "coretemp": "CPU",
|
||||||
|
"amdgpu": "核显", "radeon": "核显", "nct6775": "主板",
|
||||||
|
"nct6683": "主板", "nct6686": "主板", "nct6687": "主板",
|
||||||
|
"drivetemp": "硬盘", "nvme": "硬盘", "iwlwifi": "无线",
|
||||||
|
"mt7921_phy0": "无线", "r8169_0_2a00:00": "网卡", "r8169": "网卡"}
|
||||||
|
try:
|
||||||
|
for base in ("/host/sys/class/hwmon", "/sys/class/hwmon"):
|
||||||
|
if not os.path.isdir(base):
|
||||||
|
continue
|
||||||
|
for h in sorted(os.listdir(base)):
|
||||||
|
d = os.path.join(base, h)
|
||||||
|
if not os.path.isdir(d):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
with open(os.path.join(d, "name")) as f:
|
||||||
|
chip = f.read().strip()
|
||||||
|
except Exception:
|
||||||
|
chip = h
|
||||||
|
label = HWMON_LABEL.get(chip, chip)
|
||||||
|
for i in (1, 2, 3, 4, 5):
|
||||||
|
tf = os.path.join(d, "temp%d_input" % i)
|
||||||
|
if not os.path.isfile(tf):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
with open(tf) as f:
|
||||||
|
v = float(f.read().strip()) / 1000.0
|
||||||
|
if -40 < v < 130:
|
||||||
|
lf = os.path.join(d, "temp%d_label" % i)
|
||||||
|
nm = label
|
||||||
|
try:
|
||||||
|
if os.path.isfile(lf):
|
||||||
|
with open(lf) as f:
|
||||||
|
nm = "%s(%s)" % (label, f.read().strip())
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
temps.append({"name": nm, "value": round(v, 1)})
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
for i in (1, 2, 3, 4, 5, 6):
|
||||||
|
ff = os.path.join(d, "fan%d_input" % i)
|
||||||
|
if not os.path.isfile(ff):
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
with open(ff) as f:
|
||||||
|
v = int(float(f.read().strip()))
|
||||||
|
if v > 0:
|
||||||
|
fans.append({"name": "%s 风扇%d" % (label, i), "value": v})
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
if temps or fans:
|
||||||
|
break
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
note = "" if (temps or fans) else "宿主未暴露温度/转速传感器(容器读不到属正常,见 README 说明)"
|
||||||
|
return jsonify({"temps": temps, "fans": fans, "note": note})
|
||||||
|
|
||||||
@app.route("/api/mem/drop", methods=["POST"])
|
@app.route("/api/mem/drop", methods=["POST"])
|
||||||
def api_mem_drop():
|
def api_mem_drop():
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -971,5 +1533,20 @@ def api_kill():
|
|||||||
def health():
|
def health():
|
||||||
return jsonify({"ok": True})
|
return jsonify({"ok": True})
|
||||||
|
|
||||||
|
@app.route("/api/license-config")
|
||||||
|
def license_config():
|
||||||
|
return jsonify({
|
||||||
|
"version": HUB_VERSION,
|
||||||
|
"latest": HUB.get("latest") or "",
|
||||||
|
"update_available": bool(HUB.get("update_available")),
|
||||||
|
"update_required": bool(HUB.get("update_required")),
|
||||||
|
"download_url": HUB.get("download_url") or "",
|
||||||
|
"changelog": HUB.get("changelog") or "",
|
||||||
|
"announcement": (HUB.get("announcements") or [None])[0],
|
||||||
|
"announcements": HUB.get("announcements") or [],
|
||||||
|
"popup": HUB.get("popup") or [],
|
||||||
|
"hub_ok": bool(HUB.get("ok")),
|
||||||
|
})
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", port=PORT)
|
app.run(host="0.0.0.0", port=PORT, threaded=True)
|
||||||
@@ -8,7 +8,14 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- PORT=7031
|
- PORT=7031
|
||||||
- PROCFS_PATH=/host/proc
|
- PROCFS_PATH=/host/proc
|
||||||
|
- SITE_VERSION=1.3.15
|
||||||
|
- HUB_URL=https://auth.88531.cn/api
|
||||||
|
- HUB_PROJECT_ID=12
|
||||||
|
- HUB_KEY_FILE=/run/secrets/hub_key
|
||||||
|
- PERF_FILE=/run/secrets/perf_mode.json
|
||||||
privileged: true
|
privileged: true
|
||||||
volumes:
|
volumes:
|
||||||
- /proc:/host/proc:rw
|
- /proc:/host/proc:rw
|
||||||
- /sys:/host/sys:ro
|
- /sys:/host/sys:ro
|
||||||
|
- /root/.fnos_resmon_hub_key:/run/secrets/hub_key:ro
|
||||||
|
- /root/.fnos_resmon_perf.json:/run/secrets/perf_mode.json:rw
|
||||||
|
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 326 KiB |
|
Before Width: | Height: | Size: 308 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 319 KiB After Width: | Height: | Size: 328 KiB |
|
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 352 KiB |
@@ -2,8 +2,8 @@
|
|||||||
<blockquote>
|
<blockquote>
|
||||||
<p>飞牛 NAS 专属的轻量级系统资源监控面板 —— 一个 Docker 命令即可拥有媲美专业 NAS 监控的 Web 界面。</p>
|
<p>飞牛 NAS 专属的轻量级系统资源监控面板 —— 一个 Docker 命令即可拥有媲美专业 NAS 监控的 Web 界面。</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
<p>你家飞牛 NAS 卡顿、内存飙升,却只能看到系统自带的一个百分比数字?哪个进程在吃 CPU?哪块盘快坏了?哪个端口被谁占用了?一键能回收内存吗?这些飞牛自带都做不到。</p>
|
<p>你家飞牛 NAS 卡顿、内存飙升,却只能看到系统自带的一个百分比数字?哪个进程在吃 CPU?CPU 烧到多少度?风扇转不转?当前配置到底顶不顶得住?哪块盘快坏了?哪个端口被谁占用了?一键能回收内存吗?这些飞牛自带都做不到。</p>
|
||||||
<p><strong>飞牛资源管理器(fnos-resmon)</strong> 正好补上这些短板:CPU / 内存 / 磁盘 / 网络四大面板,进程级明细,一条 docker 命令启动。</p>
|
<p><strong>飞牛资源管理器(fnos-resmon)</strong> 正好补上这些短板:CPU / 内存 / 磁盘 / 网络四大面板,进程级明细,CPU 温度风扇、负载诊断、一键优化全都有,一条 docker 命令启动。</p>
|
||||||
<h2>一句话说清优势</h2>
|
<h2>一句话说清优势</h2>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@@ -25,6 +25,21 @@
|
|||||||
<td>✅ 进程名/PID/用户/状态/线程数</td>
|
<td>✅ 进程名/PID/用户/状态/线程数</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td>CPU 温度/风扇转速</td>
|
||||||
|
<td>❌ 无</td>
|
||||||
|
<td>✅ 11 路温度 + 风扇 RPM,超温变色预警</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>负载诊断:配置顶不顶得住</td>
|
||||||
|
<td>❌ 无</td>
|
||||||
|
<td>✅ 单核负载公式 + 四档结论 + 流畅建议</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>一键优化系统</td>
|
||||||
|
<td>❌ 无</td>
|
||||||
|
<td>✅ 🚀 落盘 + 回收缓存 + 内存整理</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td>内存 RSS/USS/SWAP 明细</td>
|
<td>内存 RSS/USS/SWAP 明细</td>
|
||||||
<td>❌ 无</td>
|
<td>❌ 无</td>
|
||||||
<td>✅ 三列细分</td>
|
<td>✅ 三列细分</td>
|
||||||
@@ -32,7 +47,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>一键内存回收</td>
|
<td>一键内存回收</td>
|
||||||
<td>❌ 无</td>
|
<td>❌ 无</td>
|
||||||
<td>✅ 🧹 一键回收未使用的内存</td>
|
<td>✅ 🧹 绿色大按钮,一键释放</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>一键结束异常进程</td>
|
<td>一键结束异常进程</td>
|
||||||
@@ -54,28 +69,34 @@
|
|||||||
<td>❌ 无</td>
|
<td>❌ 无</td>
|
||||||
<td>✅ 有</td>
|
<td>✅ 有</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>刷新间隔设置/停止刷新</td>
|
||||||
|
<td>❌ 无</td>
|
||||||
|
<td>✅ 3s/5s/10s/30s/60s + ⏸ 随时暂停</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<h2>CPU 面板:谁在偷吃一眼看清</h2>
|
<h2>CPU 面板:温度风扇 + 负载诊断 + 一键优化</h2>
|
||||||
<p>CPU 型号、架构、物理/逻辑核数一目了然,进程级 CPU 排行实时刷新,点表头即排序。</p>
|
<p>CPU 型号、架构、物理/逻辑核数、每核频率占用一目了然,进程级 CPU 排行实时刷新,点表头即排序。</p>
|
||||||
<p><img alt="CPU面板" src="http://img.88531.cn/i/2026/11/07/6aee0007e9bf2.png" /></p>
|
<p>本版新增三样硬货:🌡️ 温度 / 🌀 风扇面板(CPU 63°C 红色预警、主板/硬盘/网卡全路温度、风扇1 1200 转上下实时 RPM,读不到的机器显示友好提示不报错);📊 负载诊断(1分钟负载 ÷ 逻辑核数 = 单核负载,直接告诉你“顶得住还是顶不住”,并点名头号吃 CPU 进程);🚀 一键优化系统(数据落盘 + 回收内存缓存 + 内存碎片整理,实测一次释放 500MB+)。</p>
|
||||||
|
<p><img alt="CPU面板" src="https://img.88531.cn/i/2026/11/07/6aeeca97f31e3.png" /></p>
|
||||||
<h2>内存面板:一键回收释放空间</h2>
|
<h2>内存面板:一键回收释放空间</h2>
|
||||||
<p>每个进程 RSS/USS/SWAP 三列细分,🧹 一键回收未使用的内存,异常进程一键结束。</p>
|
<p>每个进程 RSS/USS/SWAP 三列细分,物理内存槽位(容量/类型/频率/厂商)全展示。右上角 🧹 绿色大按钮一键回收未使用的内存,异常进程一键结束,Swap 用量一目了然。</p>
|
||||||
<p><img alt="内存面板" src="http://img.88531.cn/i/2026/11/07/6aee000887b6a.png" /></p>
|
<p><img alt="内存面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9a62947.png" /></p>
|
||||||
<h2>磁盘面板:硬盘健康提前预警</h2>
|
<h2>磁盘面板:硬盘健康提前预警</h2>
|
||||||
<p>SMART 健康、温度、通电时间 Web 直观展示,硬盘故障提前发现。</p>
|
<p>SMART 健康、温度、通电时间、坏道重映射 Web 直观展示,阵列拓扑、挂载点用量、进程 IO 排行全有,硬盘故障提前发现。</p>
|
||||||
<p><img alt="磁盘面板" src="http://img.88531.cn/i/2026/11/07/6aee000936412.png" /></p>
|
<p><img alt="磁盘面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9d2b3a2.png" /></p>
|
||||||
<h2>网络面板:谁在联网一目了然</h2>
|
<h2>网络面板:谁在联网一目了然</h2>
|
||||||
<p>所有 TCP 连接和侦听端口明细,进程+地址+状态,网卡驱动/MTU/双工全展示。</p>
|
<p>实时上下行速率、累计收发、连接数统计,所有 TCP 连接和侦听端口明细(进程+地址+状态),网卡驱动/速率/双工/MTU 全展示,BT 占带宽一眼揪出。</p>
|
||||||
<p><img alt="网络面板" src="http://img.88531.cn/i/2026/11/07/6aee0009c4d5e.png" /></p>
|
<p><img alt="网络面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9f70e61.png" /></p>
|
||||||
<h2>一条命令安装</h2>
|
<h2>一条命令安装</h2>
|
||||||
<pre><code class="language-bash">docker run -d --name fnos-resmon --privileged --network host --pid host \
|
<pre><code class="language-bash">docker run -d --name fnos-resmon -p 7031:7031 --privileged \
|
||||||
-v /proc:/host/proc:rw -v /sys:/host/sys:ro \
|
-v /proc:/host/proc:rw -v /sys:/host/sys:ro \
|
||||||
-e PORT=7031 -e PROCFS_PATH=/host/proc \
|
jpccr.ccs.tencentyun.com/jinghui/fnos-resmon:latest
|
||||||
192.168.68.19:3200/jinghui/fnos-resmon:latest
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>浏览器打开 <code>http://NAS-IP:7031</code> 即可使用,手机也能看。</p>
|
<p>浏览器打开 <code>http://NAS-IP:7031</code> 即可使用,手机也能看。</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>开源地址:https://gitea.88531.cn/jinghui/fnos-resmon</li>
|
<li>开源地址:https://gitea.88531.cn/jinghui/fnos-resmon</li>
|
||||||
<li>3 秒自动刷新,零侵入,Docker 运行不修改系统文件</li>
|
<li>右上角可调刷新间隔(3s/5s/10s/30s/60s),随时暂停刷新</li>
|
||||||
|
<li>零侵入,Docker 运行不修改系统文件</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
> 飞牛 NAS 专属的轻量级系统资源监控面板 —— 一个 Docker 命令即可拥有媲美专业 NAS 监控的 Web 界面。
|
> 飞牛 NAS 专属的轻量级系统资源监控面板 —— 一个 Docker 命令即可拥有媲美专业 NAS 监控的 Web 界面。
|
||||||
|
|
||||||
你家飞牛 NAS 卡顿、内存飙升,却只能看到系统自带的一个百分比数字?哪个进程在吃 CPU?哪块盘快坏了?哪个端口被谁占用了?一键能回收内存吗?这些飞牛自带都做不到。
|
你家飞牛 NAS 卡顿、内存飙升,却只能看到系统自带的一个百分比数字?哪个进程在吃 CPU?CPU 烧到多少度?风扇转不转?当前配置到底顶不顶得住?哪块盘快坏了?哪个端口被谁占用了?一键能回收内存吗?这些飞牛自带都做不到。
|
||||||
|
|
||||||
**飞牛资源管理器(fnos-resmon)** 正好补上这些短板:CPU / 内存 / 磁盘 / 网络四大面板,进程级明细,一条 docker 命令启动。
|
**飞牛资源管理器(fnos-resmon)** 正好补上这些短板:CPU / 内存 / 磁盘 / 网络四大面板,进程级明细,CPU 温度风扇、负载诊断、一键优化全都有,一条 docker 命令启动。
|
||||||
|
|
||||||
## 一句话说清优势
|
## 一句话说清优势
|
||||||
|
|
||||||
@@ -12,47 +12,53 @@
|
|||||||
|------|---------|-------------|
|
|------|---------|-------------|
|
||||||
| CPU/内存占用率 | ✅ 有 | ✅ 有 |
|
| CPU/内存占用率 | ✅ 有 | ✅ 有 |
|
||||||
| 进程级 CPU/内存排行 | ❌ 无 | ✅ 进程名/PID/用户/状态/线程数 |
|
| 进程级 CPU/内存排行 | ❌ 无 | ✅ 进程名/PID/用户/状态/线程数 |
|
||||||
|
| CPU 温度/风扇转速 | ❌ 无 | ✅ 11 路温度 + 风扇 RPM,超温变色预警 |
|
||||||
|
| 负载诊断:配置顶不顶得住 | ❌ 无 | ✅ 单核负载公式 + 四档结论 + 流畅建议 |
|
||||||
|
| 一键优化系统 | ❌ 无 | ✅ 🚀 落盘 + 回收缓存 + 内存整理 |
|
||||||
| 内存 RSS/USS/SWAP 明细 | ❌ 无 | ✅ 三列细分 |
|
| 内存 RSS/USS/SWAP 明细 | ❌ 无 | ✅ 三列细分 |
|
||||||
| 一键内存回收 | ❌ 无 | ✅ 🧹 一键回收未使用的内存 |
|
| 一键内存回收 | ❌ 无 | ✅ 🧹 绿色大按钮,一键释放 |
|
||||||
| 一键结束异常进程 | ❌ 无 | ✅ 一键 kill |
|
| 一键结束异常进程 | ❌ 无 | ✅ 一键 kill |
|
||||||
| 磁盘 SMART/温度/通电时间 | ❌ 需命令行 | ✅ Web 直观展示 |
|
| 磁盘 SMART/温度/通电时间 | ❌ 需命令行 | ✅ Web 直观展示 |
|
||||||
| TCP 连接明细/侦听端口 | ❌ 无 | ✅ 进程+地址+状态 |
|
| TCP 连接明细/侦听端口 | ❌ 无 | ✅ 进程+地址+状态 |
|
||||||
| 网卡驱动/MTU/双工 | ❌ 无 | ✅ 有 |
|
| 网卡驱动/MTU/双工 | ❌ 无 | ✅ 有 |
|
||||||
|
| 刷新间隔设置/停止刷新 | ❌ 无 | ✅ 3s/5s/10s/30s/60s + ⏸ 随时暂停 |
|
||||||
|
|
||||||
## CPU 面板:谁在偷吃一眼看清
|
## CPU 面板:温度风扇 + 负载诊断 + 一键优化
|
||||||
|
|
||||||
CPU 型号、架构、物理/逻辑核数一目了然,进程级 CPU 排行实时刷新,点表头即排序。
|
CPU 型号、架构、物理/逻辑核数、每核频率占用一目了然,进程级 CPU 排行实时刷新,点表头即排序。
|
||||||
|
|
||||||

|
本版新增三样硬货:🌡️ 温度 / 🌀 风扇面板(CPU 63°C 红色预警、主板/硬盘/网卡全路温度、风扇1 1200 转上下实时 RPM,读不到的机器显示友好提示不报错);📊 负载诊断(1分钟负载 ÷ 逻辑核数 = 单核负载,直接告诉你"顶得住还是顶不住",并点名头号吃 CPU 进程);🚀 一键优化系统(数据落盘 + 回收内存缓存 + 内存碎片整理,实测一次释放 500MB+)。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## 内存面板:一键回收释放空间
|
## 内存面板:一键回收释放空间
|
||||||
|
|
||||||
每个进程 RSS/USS/SWAP 三列细分,🧹 一键回收未使用的内存,异常进程一键结束。
|
每个进程 RSS/USS/SWAP 三列细分,物理内存槽位(容量/类型/频率/厂商)全展示。右上角 🧹 绿色大按钮一键回收未使用的内存,异常进程一键结束,Swap 用量一目了然。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 磁盘面板:硬盘健康提前预警
|
## 磁盘面板:硬盘健康提前预警
|
||||||
|
|
||||||
SMART 健康、温度、通电时间 Web 直观展示,硬盘故障提前发现。
|
SMART 健康、温度、通电时间、坏道重映射 Web 直观展示,阵列拓扑、挂载点用量、进程 IO 排行全有,硬盘故障提前发现。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 网络面板:谁在联网一目了然
|
## 网络面板:谁在联网一目了然
|
||||||
|
|
||||||
所有 TCP 连接和侦听端口明细,进程+地址+状态,网卡驱动/MTU/双工全展示。
|
实时上下行速率、累计收发、连接数统计,所有 TCP 连接和侦听端口明细(进程+地址+状态),网卡驱动/速率/双工/MTU 全展示,BT 占带宽一眼揪出。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 一条命令安装
|
## 一条命令安装
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -d --name fnos-resmon --privileged --network host --pid host \
|
docker run -d --name fnos-resmon -p 7031:7031 --privileged \
|
||||||
-v /proc:/host/proc:rw -v /sys:/host/sys:ro \
|
-v /proc:/host/proc:rw -v /sys:/host/sys:ro \
|
||||||
-e PORT=7031 -e PROCFS_PATH=/host/proc \
|
jpccr.ccs.tencentyun.com/jinghui/fnos-resmon:latest
|
||||||
192.168.68.19:3200/jinghui/fnos-resmon:latest
|
|
||||||
```
|
```
|
||||||
|
|
||||||
浏览器打开 `http://NAS-IP:7031` 即可使用,手机也能看。
|
浏览器打开 `http://NAS-IP:7031` 即可使用,手机也能看。
|
||||||
|
|
||||||
- 开源地址:https://gitea.88531.cn/jinghui/fnos-resmon
|
- 开源地址:https://gitea.88531.cn/jinghui/fnos-resmon
|
||||||
- 3 秒自动刷新,零侵入,Docker 运行不修改系统文件
|
- 右上角可调刷新间隔(3s/5s/10s/30s/60s),随时暂停刷新
|
||||||
|
- 零侵入,Docker 运行不修改系统文件
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
<h2>前言:飞牛自带的监控,为什么不够用</h2>
|
||||||
|
<p>飞牛 NAS 自带的资源监控只有一个百分比数字:CPU 多少、内存多少,没了。但实际运维中真正要回答的问题是:<strong>是哪个进程在吃 CPU?内存被谁占了?CPU 烧到多少度?风扇转不转?这台机器的配置到底顶不顶得住?哪块盘快坏了?哪个端口被谁占着?</strong></p>
|
||||||
|
<p>于是我写了 <strong>fnos-resmon(飞牛资源管理器)</strong>:一个单文件 Flask + psutil 的轻量监控面板,专为飞牛 NAS 设计,一条 docker 命令启动,浏览器打开 <code>http://NAS-IP:7031</code> 就能看,手机也能看。</p>
|
||||||
|
<p>开源地址:https://gitea.88531.cn/jinghui/fnos-resmon</p>
|
||||||
|
<h2>一、它能做什么</h2>
|
||||||
|
<ul>
|
||||||
|
<li><strong>CPU 面板</strong>:型号 / 架构 / 物理核 / 逻辑核 / 每核频率占用,进程级 CPU 排行(进程名 / PID / 用户 / 状态 / 线程数),点表头即排序</li>
|
||||||
|
<li><strong>🌡️ 温度 / 🌀 风扇面板</strong>:11 路温度 + 风扇实时 RPM,超温变色预警,读不到的机器显示友好提示不报错</li>
|
||||||
|
<li><strong>📊 负载诊断</strong>:1 分钟负载 ÷ 逻辑核数 = 单核负载,直接告诉你"顶得住还是顶不住",并点名头号吃 CPU 进程</li>
|
||||||
|
<li><strong>🚀 一键优化系统</strong>:数据落盘 + 回收内存缓存 + 内存碎片整理,实测一次释放 500MB+</li>
|
||||||
|
<li><strong>内存面板</strong>:每个进程 RSS / USS / SWAP 三列细分,物理内存槽位(容量 / 类型 / 频率 / 厂商)全展示,🧹 绿色大按钮一键回收内存</li>
|
||||||
|
<li><strong>磁盘面板</strong>:SMART 健康 / 温度 / 通电时间 / 坏道重映射,阵列拓扑、挂载点用量、进程 IO 排行</li>
|
||||||
|
<li><strong>网络面板</strong>:实时上下行速率、累计收发、连接数,所有 TCP 连接和侦听端口明细(进程 + 地址 + 状态),网卡驱动 / 速率 / 双工 / MTU</li>
|
||||||
|
<li><strong>一键 kill 异常进程</strong>,右上角可调刷新间隔(3s / 5s / 10s / 30s / 60s)+ ⏸ 随时暂停</li>
|
||||||
|
</ul>
|
||||||
|
<h2>二、实现原理:容器里怎么读到宿主真实数据</h2>
|
||||||
|
<p>监控跑在 Docker 里,默认只能看到容器自己的 namespace。要读宿主真实数据,靠三招:</p>
|
||||||
|
<pre><code class="language-yaml">services:
|
||||||
|
fnos-resmon:
|
||||||
|
image: jpccr.ccs.tencentyun.com/jinghui/fnos-resmon:latest
|
||||||
|
network_mode: host
|
||||||
|
pid: host # 与宿主共享 PID 命名空间
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /proc:/host/proc:rw # 宿主 proc
|
||||||
|
- /sys:/host/sys:ro # 宿主 sysfs(温度/风扇/网卡从这读)</code></pre>
|
||||||
|
<p><strong>1. CPU / 内存 / 进程:psutil 重定向 PROCFS。</strong>启动时把 <code>psutil.PROCFS_PATH</code> 指向 <code>/host/proc</code>,之后所有 <code>psutil.process_iter / cpu_percent / virtual_memory</code> 读到的都是宿主数据:</p>
|
||||||
|
<pre><code class="language-python">PROCFS = os.environ.get("PROCFS_PATH", "/host/proc")
|
||||||
|
if os.path.isdir(PROCFS):
|
||||||
|
psutil.PROCFS_PATH = PROCFS</code></pre>
|
||||||
|
<p><strong>2. 网络:nsenter 进宿主 netns。</strong>容器即使 bridged 模式,直读 <code>/proc/net</code> 也只能看到容器自身。网络类数据统一经 <code>nsenter --target 1 --mount --net</code> 在宿主(PID 1)netns 里执行 <code>cat /proc/net/dev</code> 和 <code>ss -tunHn state all</code>,失败才回退到 psutil 容器视角:</p>
|
||||||
|
<pre><code class="language-python">NSENTER = ["nsenter", "--target", "1", "--mount", "--net"]
|
||||||
|
|
||||||
|
def _host_ss():
|
||||||
|
"""宿主 tcp/udp 连接+监听,经 nsenter 在宿主 netns 执行 ss"""
|
||||||
|
out = _nsenter_run(["ss", "-tunHn", "state", "all"])</code></pre>
|
||||||
|
<p>ss 行尾的 <code>("进程名",pid=1234,...)</code> 会被正则抠出来,再用进程表按 PID 补齐进程名,前 80 条连接 + 前 80 条监听返回前端。</p>
|
||||||
|
<p><strong>3. 后台采样线程 + 2 秒缓存。</strong>进程 CPU 统计需要两次采样算差值,所以 <code>sample_procs()</code> 先全员 <code>cpu_percent(None)</code> 打点,sleep 1 秒后再读数,按 CPU 倒序,前端每 2 秒拿到的是缓存,不会每次请求都卡 1 秒:</p>
|
||||||
|
<pre><code class="language-python">def sampler_loop():
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
sample_procs()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
threading.Thread(target=sampler_loop, daemon=True).start()</code></pre>
|
||||||
|
<p>每个进程采集的字段:cpu / mem / rss / uss / swap / 线程数 / 用户 / 状态 / IO 读写 / 连接数。容器内 <code>/etc/passwd</code> 没有宿主用户,纯数字 uid 会经 <code>/host/etc/passwd</code> 还原用户名(5 分钟缓存)。</p>
|
||||||
|
<h2>三、两个最实用的接口:负载诊断与一键优化</h2>
|
||||||
|
<p><strong>GET /api/cpu/advise —— 配置顶不顶得住,一句话结论。</strong>公式很简单:<code>单核负载 = 1分钟load ÷ 逻辑核数</code>,分四档给结论,并点名最吃 CPU 的进程、给出扩容 / 杀进程 / 属正常的建议:</p>
|
||||||
|
<pre><code class="language-python">@app.route("/api/cpu/advise")
|
||||||
|
def api_cpu_advise():
|
||||||
|
load = list(os.getloadavg()) # 1/5/15 分钟
|
||||||
|
per_core = load[0] / logical # 单核负载
|
||||||
|
# 四档:<0.7 轻松 / <1.0 饱和 / <2.0 吃力 / 更高 过载</code></pre>
|
||||||
|
<p><strong>POST /api/sys/optimize —— 一键优化。</strong>依次做三件事:<code>sync</code> 数据落盘 → 写 <code>/host/proc/sys/vm/drop_caches</code> 回收 pagecache → 写 <code>/host/proc/sys/vm/compact_memory</code> 整理碎片。内存面板另有 <strong>POST /api/mem/drop</strong> 单独回收。零侵入:只调内核已有接口,不改系统文件。</p>
|
||||||
|
<p><strong>GET /api/sensors —— 温度风扇。</strong>优先读 <code>/host/sys/class/hwmon</code>,回退 <code>/sys/class/hwmon</code>,<code>temp*_input ÷ 1000</code> 得摄氏度,<code>fan*_input</code> 即 RPM,label 优先用 <code>temp*_label</code>。超温阈值前端变色预警,风扇节点不存在(如纯 NAS 小主机无风扇上报)的机器返回空 + 友好提示,不阻塞主流程。</p>
|
||||||
|
<h2>四、API 一览</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>方法</th>
|
||||||
|
<th>路径</th>
|
||||||
|
<th>作用</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/cpu</code></td>
|
||||||
|
<td>CPU 信息 + 每核占用 + 进程排行 + load</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/mem</code></td>
|
||||||
|
<td>内存占用 + RSS/USS/SWAP 进程明细 + 槽位硬件</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/disk</code></td>
|
||||||
|
<td>挂载用量 + SMART/温度/通电时间 + 阵列 + IO 排行</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/net</code></td>
|
||||||
|
<td>网卡速率 + TCP/监听明细 + 硬件(驱动/MTU/双工)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/sensors</code></td>
|
||||||
|
<td>11 路温度 + 风扇 RPM</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/cpu/advise</code></td>
|
||||||
|
<td>负载诊断:四档结论 + 头号进程 + 建议</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>POST</td>
|
||||||
|
<td><code>/api/sys/optimize</code></td>
|
||||||
|
<td>一键优化:落盘 + 回收缓存 + 内存整理</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>POST</td>
|
||||||
|
<td><code>/api/mem/drop</code></td>
|
||||||
|
<td>一键内存回收</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>POST</td>
|
||||||
|
<td><code>/api/kill</code></td>
|
||||||
|
<td>结束异常进程(限宿主 PID)</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GET</td>
|
||||||
|
<td><code>/api/health</code></td>
|
||||||
|
<td>健康检查</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h2>五、部署:一条命令</h2>
|
||||||
|
<pre><code class="language-bash">docker run -d --name fnos-resmon -p 7031:7031 --privileged \
|
||||||
|
-v /proc:/host/proc:rw -v /sys:/host/sys:ro \
|
||||||
|
jpccr.ccs.tencentyun.com/jinghui/fnos-resmon:latest</code></pre>
|
||||||
|
<p>浏览器打开 <code>http://NAS-IP:7031</code> 即可。前端是单个静态页(改前端必须重建镜像),后端一个 <code>app.py</code> 约 1100 行,无数据库,开箱即用。</p>
|
||||||
|
<h2>六、实测截图(v1.3.4 当前版本)</h2>
|
||||||
|
<p>CPU 面板:63°C 红色预警、风扇 1200 转 RPM、负载诊断四档结论、一键优化按钮:</p>
|
||||||
|
<p><img alt="CPU面板" src="https://img.88531.cn/i/2026/11/07/6aeeca97f31e3.png" /></p>
|
||||||
|
<p>内存面板:RSS/USS/SWAP 三列细分 + 🧹 一键回收大按钮:</p>
|
||||||
|
<p><img alt="内存面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9a62947.png" /></p>
|
||||||
|
<p>磁盘面板:3 盘 SMART 全 PASSED + 温度通电时间:</p>
|
||||||
|
<p><img alt="磁盘面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9d2b3a2.png" /></p>
|
||||||
|
<p>网络面板:qbittorrent 482 连接一眼揪出吃带宽进程:</p>
|
||||||
|
<p><img alt="网络面板" src="https://img.88531.cn/i/2026/11/07/6aeeca9f70e61.png" /></p>
|
||||||
|
<h2>七、总结</h2>
|
||||||
|
<p>飞牛自带监控解决"有没有",fnos-resmon 解决"是谁、多少度、顶不顶得住、能不能一键收拾"。核心就三招:<strong>psutil 重定向宿主 proc、nsenter 进宿主 netns 读网络、后台线程 2 秒缓存进程快照</strong>,剩下的都是把数据摆整齐。如果你也在飞牛上跑了很多 Docker 服务,装一个看看头号吃 CPU 的到底是谁 —— 八成有惊喜。</p>
|
||||||
|
<p>镜像:<code>jpccr.ccs.tencentyun.com/jinghui/fnos-resmon:latest</code> | 开源:https://gitea.88531.cn/jinghui/fnos-resmon | 端口 7031,欢迎提 issue。</p>
|
||||||
@@ -20,7 +20,7 @@ body{font-family:-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;backgr
|
|||||||
.stat .v{font-size:15px}
|
.stat .v{font-size:15px}
|
||||||
.v.green{color:#20a53a}
|
.v.green{color:#20a53a}
|
||||||
table{width:calc(100% - 32px);margin:0 16px 20px;border-collapse:collapse;font-size:13px;table-layout:fixed}
|
table{width:calc(100% - 32px);margin:0 16px 20px;border-collapse:collapse;font-size:13px;table-layout:fixed}
|
||||||
thead th{background:#f7f7f7;color:#555;font-weight:400;text-align:left;padding:10px 8px;white-space:nowrap;overflow:hidden}
|
thead th{background:#f7f7f7;color:#555;font-weight:400;text-align:left;padding:10px 8px;white-space:nowrap;overflow:hidden}thead th[onclick]{cursor:pointer;user-select:none}thead th[onclick]:hover{color:#20a53a}
|
||||||
tbody td{padding:9px 8px;border-bottom:1px solid #f2f2f2;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
tbody td{padding:9px 8px;border-bottom:1px solid #f2f2f2;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||||
tbody td.desc{max-width:340px}
|
tbody td.desc{max-width:340px}
|
||||||
a.proc{color:#20a53a;text-decoration:none;white-space:nowrap}
|
a.proc{color:#20a53a;text-decoration:none;white-space:nowrap}
|
||||||
@@ -47,6 +47,11 @@ button.refresh{background:#20a53a;color:#fff;border:none;border-radius:3px;paddi
|
|||||||
.corecell .cb{height:8px;background:#f0f0f0;border-radius:4px;overflow:hidden}
|
.corecell .cb{height:8px;background:#f0f0f0;border-radius:4px;overflow:hidden}
|
||||||
.corecell .cb>i{display:block;height:100%;background:#20a53a;border-radius:4px}
|
.corecell .cb>i{display:block;height:100%;background:#20a53a;border-radius:4px}
|
||||||
.corecell .ct{font-size:11px;color:#999;margin-top:2px;font-variant-numeric:tabular-nums}
|
.corecell .ct{font-size:11px;color:#999;margin-top:2px;font-variant-numeric:tabular-nums}
|
||||||
|
.perfbtn{border:1px solid #ddd;background:#fff;border-radius:6px;padding:8px 18px;font-size:14px;cursor:pointer;margin-right:8px}
|
||||||
|
.perfbtn.cur{background:#20a53a;border-color:#20a53a;color:#fff;font-weight:700}
|
||||||
|
.benchbtn{border:1px solid #20a53a;background:#20a53a;color:#fff;border-radius:6px;padding:8px 18px;font-size:14px;cursor:pointer}
|
||||||
|
.benchbtn:disabled{background:#ccc;border-color:#ccc;cursor:wait}
|
||||||
|
.benchhist{font-size:12px;color:#666;line-height:1.8;margin-top:4px}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -56,32 +61,61 @@ button.refresh{background:#20a53a;color:#fff;border:none;border-radius:3px;paddi
|
|||||||
<div class="tab" data-t="disk">磁盘</div>
|
<div class="tab" data-t="disk">磁盘</div>
|
||||||
<div class="tab" data-t="net">网络</div>
|
<div class="tab" data-t="net">网络</div>
|
||||||
<div style="margin-left:auto;display:flex;align-items:center;gap:12px;padding-right:16px;font-size:12px">
|
<div style="margin-left:auto;display:flex;align-items:center;gap:12px;padding-right:16px;font-size:12px">
|
||||||
<span style="color:#999">v1.2.8</span>
|
<span id="licBell" onclick="toggleAnn()" title="公告" style="cursor:pointer;position:relative;font-size:15px">🔔<i id="licDot" style="display:none;position:absolute;top:-2px;right:-4px;width:8px;height:8px;border-radius:50%;background:#f00"></i></span>
|
||||||
|
<span id="licVer" onclick="checkVer(true)" title="点击检查新版本" style="color:#999;cursor:pointer">v1.3.15</span>
|
||||||
|
<label style="color:#999">刷新 <select id="ival" onchange="setIval(this.value)" style="border:1px solid #ddd;border-radius:3px;padding:2px 4px;color:#333"><option value="3">3s</option><option value="5">5s</option><option value="10">10s</option><option value="30">30s</option><option value="60">60s</option></select></label>
|
||||||
|
<button id="pauseBtn" onclick="togglePause()" style="background:#ff9900;color:#fff;border:none;border-radius:3px;padding:3px 10px;cursor:pointer">⏸ 停止刷新</button>
|
||||||
<a href="https://nav.88531.cn" target="_blank" style="color:#20a53a;text-decoration:none">资享导航站</a>
|
<a href="https://nav.88531.cn" target="_blank" style="color:#20a53a;text-decoration:none">资享导航站</a>
|
||||||
<a href="https://gitea.88531.cn/jinghui/fnos-resmon" target="_blank" style="color:#20a53a;text-decoration:none">开源地址</a>
|
<a href="https://gitea.88531.cn/jinghui/fnos-resmon" target="_blank" style="color:#20a53a;text-decoration:none">开源地址</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card" id="summary"></div>
|
<div class="card" id="summary"></div>
|
||||||
<div class="cpuinfo" id="cpuinfo" style="display:none"></div>
|
<div class="cpuinfo" id="cpuinfo" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="cpuperf" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="cpubench" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="cpusensor" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="cpuadvise" style="display:none"></div>
|
||||||
<div class="cpuinfo" id="meminfo" style="display:none"></div>
|
<div class="cpuinfo" id="meminfo" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="membench" style="display:none"></div>
|
||||||
<div class="cpuinfo" id="diskinfo" style="display:none"></div>
|
<div class="cpuinfo" id="diskinfo" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="diskbench" style="display:none"></div>
|
||||||
<div class="cpuinfo" id="netinfo" style="display:none"></div>
|
<div class="cpuinfo" id="netinfo" style="display:none"></div>
|
||||||
|
<div class="cpuinfo" id="netbench" style="display:none"></div>
|
||||||
<div class="toolbar"><span id="sub"></span><span><span id="ts" style="margin-right:10px"></span><button class="refresh" onclick="load(true)">刷新</button></span></div>
|
<div class="toolbar"><span id="sub"></span><span><span id="ts" style="margin-right:10px"></span><button class="refresh" onclick="load(true)">刷新</button></span></div>
|
||||||
<div class="scrollarea"><table>
|
<div class="scrollarea"><table>
|
||||||
<thead id="thead"></thead>
|
<thead id="thead"></thead>
|
||||||
<tbody id="tbody"></tbody>
|
<tbody id="tbody"></tbody>
|
||||||
</table>
|
</table>
|
||||||
<div id="disks"></div><div id="netextra"></div></div>
|
<div id="disks"></div><div id="netextra"></div></div>
|
||||||
|
<div id="annPanel" style="display:none;position:fixed;top:46px;right:12px;width:340px;max-height:60vh;overflow:auto;background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.15);z-index:1000;padding:12px 14px;font-size:13px;line-height:1.8"></div>
|
||||||
|
<div id="annPop" style="display:none;position:fixed;right:12px;bottom:40px;width:340px;background:#fffbe6;border:1px solid #f0c36d;border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.15);z-index:1000;padding:12px 14px;font-size:13px;line-height:1.8"></div>
|
||||||
<script>
|
<script>
|
||||||
|
let LIC={announcements:[],popup:[]};
|
||||||
let cur='cpu';
|
let cur='cpu';
|
||||||
let sortState={key:null,dir:-1};
|
let sortState={key:null,dir:-1};
|
||||||
|
function loadSort(){try{const v=JSON.parse(localStorage.getItem('fnos_sort_'+cur)||'null');if(v&&v.key){sortState=v;return}}catch(e){}sortState={key:null,dir:-1};}
|
||||||
|
function saveSort(){try{localStorage.setItem('fnos_sort_'+cur,JSON.stringify(sortState))}catch(e){}}
|
||||||
|
loadSort();
|
||||||
let curData=null;
|
let curData=null;
|
||||||
document.querySelectorAll('.tab').forEach(t=>t.onclick=()=>{document.querySelectorAll('.tab').forEach(x=>x.classList.remove('active'));t.classList.add('active');cur=t.dataset.t;document.getElementById('disks').innerHTML='';const ci=document.getElementById('cpuinfo');if(ci)ci.style.display='none';const mi2=document.getElementById('meminfo');if(mi2)mi2.style.display='none';const di=document.getElementById('diskinfo');if(di)di.style.display='none';const ni=document.getElementById('netinfo');if(ni)ni.style.display='none';load(true)});
|
document.querySelectorAll('.tab').forEach(t=>t.onclick=()=>{document.querySelectorAll('.tab').forEach(x=>x.classList.remove('active'));t.classList.add('active');cur=t.dataset.t;loadSort();document.getElementById('disks').innerHTML='';const ci=document.getElementById('cpuinfo');if(ci)ci.style.display='none';const cs=document.getElementById('cpusensor');if(cs)cs.style.display='none';const ca=document.getElementById('cpuadvise');if(ca)ca.style.display='none';const cp=document.getElementById('cpuperf');if(cp)cp.style.display='none';const mi2=document.getElementById('meminfo');if(mi2)mi2.style.display='none';const di=document.getElementById('diskinfo');if(di)di.style.display='none';const ni=document.getElementById('netinfo');if(ni)ni.style.display='none';['cpubench','membench','diskbench','netbench'].forEach(id=>{const e=document.getElementById(id);if(e)e.style.display='none'});load(true)});
|
||||||
function fmtB(b){if(b==null)return '-';const u=['B','KB','MB','GB','TB'];let i=0;while(b>=1024&&i<4){b/=1024;i++}return b.toFixed(b>=100?0:1)+u[i]}
|
function fmtB(b){if(b==null)return '-';const u=['B','KB','MB','GB','TB'];let i=0;while(b>=1024&&i<4){b/=1024;i++}return b.toFixed(b>=100?0:1)+u[i]}
|
||||||
function fmtR(b){return fmtB(b)+'/s'}
|
function fmtR(b){return fmtB(b)+'/s'}
|
||||||
function esc(s){return String(s==null?'':s).replace(/&/g,'&').replace(/</g,'<')}
|
function esc(s){return String(s==null?'':s).replace(/&/g,'&').replace(/</g,'<')}
|
||||||
async function dropMem(){if(!confirm('一键回收未使用的内存(drop caches)?'))return;const r=await fetch('/api/mem/drop',{method:'POST'});const j=await r.json();alert(j.ok?('已回收,可用 '+fmtB(j.available)):('失败: '+j.error));load(true)}
|
async function dropMem(){if(!confirm('一键回收未使用的内存(drop caches)?'))return;const r=await fetch('/api/mem/drop',{method:'POST'});const j=await r.json();alert(j.ok?('已回收,可用 '+fmtB(j.available)):('失败: '+j.error));load(true)}
|
||||||
|
let optPoll=null;
|
||||||
|
let optState={running:false,text:''};
|
||||||
|
function restoreOptUI(){const b=document.getElementById('optBtn');const st=document.getElementById('optStopBtn');const s=document.getElementById('optStatus');if(!b||!st||!s)return;if(optState.running){b.disabled=true;b.style.cssText='background:#ccc;color:#fff;border:none;border-radius:3px;padding:6px 14px;cursor:not-allowed';st.style.display='';}else{st.style.display='none';}if(optState.text)s.textContent=optState.text;}
|
||||||
|
async function optimizeSys(){const b=document.getElementById('optBtn');const st=document.getElementById('optStopBtn');if(!b||b.disabled)return;try{const r=await fetch('/api/sys/optimize',{method:'POST'});const j=await r.json();if(r.status===409&&j.running){return}if(!j.started&&!j.ok){const s=document.getElementById('optStatus');if(s)s.textContent='启动失败,请稍后重试';return}b.disabled=true;b.style.cssText='background:#ccc;color:#fff;border:none;border-radius:3px;padding:6px 14px;cursor:not-allowed';const s=document.getElementById('optStatus');optState={running:true,text:'⏳ 正在优化系统,预计约20秒,页面数据照常刷新…'};if(s)s.textContent=optState.text;if(st)st.style.display='';if(optPoll)clearInterval(optPoll);optPoll=setInterval(pollOptStatus,2000)}catch(e){const s=document.getElementById('optStatus');if(s)s.textContent='启动失败:网络异常'}}
|
||||||
|
async function stopOpt(){let j=null;try{const r=await fetch('/api/sys/optimize/cancel',{method:'POST'});j=await r.json()}catch(e){}if(!j||!j.ok)return;const st=document.getElementById('optStopBtn');if(st)st.disabled=true;optState={running:true,stopping:true,text:'⏳ 正在停止优化…'};const s=document.getElementById('optStatus');if(s)s.textContent=optState.text}
|
||||||
|
async function pollOptStatus(){try{const r=await fetch('/api/sys/optimize/status');const j=await r.json();const s=document.getElementById('optStatus');if(j.running){optState={running:true,stopping:!!optState.stopping,text:optState.stopping?'⏳ 正在停止优化…(已用时 '+j.elapsed+' 秒)':'⏳ 正在优化系统,已用时 '+j.elapsed+' 秒,预计约20秒,页面数据照常刷新…'};if(s)s.textContent=optState.text;return}if(optPoll){clearInterval(optPoll);optPoll=null}const b=document.getElementById('optBtn');const st=document.getElementById('optStopBtn');if(b){b.disabled=false;b.style.cssText='';b.className='bigbtn'}if(st){st.style.display='none';st.disabled=false}if(j.cancelled){optState={running:false,text:'⏹ 已停止优化:'+j.steps.join(';')}}else if(j.done){optState={running:false,text:'✅ 优化完成:'+j.steps.join(';')+',释放 '+fmtB(j.freed)+',当前可用 '+fmtB(j.available)}}if(s&&optState.text)s.textContent=optState.text;load(true);setTimeout(restoreOptUI,500)}catch(e){}}
|
||||||
|
let lastAdvise=0;
|
||||||
|
async function cpuSensor(){const el=document.getElementById('cpusensor');try{const r=await fetch('/api/sensors');const j=await r.json();el.style.display='';let h='<div class="model">🌡️ 温度 / 🌀 风扇</div>';if(j.temps&&j.temps.length){const cpu=j.temps.filter(t=>t.name.indexOf('CPU')===0);const oth=j.temps.filter(t=>t.name.indexOf('CPU')!==0);const chip=t=>{const c=t.value>=85?'#f00':(t.value>=70?'#ff9900':'#20a53a');return `<span style="display:inline-block;margin:2px 10px 2px 0">${esc(t.name)} <b style="color:${c}">${t.value}°C</b></span>`};if(cpu.length)h+='<div>'+cpu.map(chip).join('')+'</div>';if(oth.length)h+='<div class="mut">'+oth.map(chip).join('')+'</div>'}if(j.fans&&j.fans.length){h+='<div>'+j.fans.map(f=>`<span style="display:inline-block;margin:2px 10px 2px 0">🌀 ${esc(f.name)} <b>${f.value} RPM</b></span>`).join('')+'</div>'}else{h+='<div class="mut">🌀 风扇转速:宿主未暴露(家用 NAS/主板多无此传感器,属正常)</div>'}if(j.note&&!j.temps.length)h+=`<div class="mut">${esc(j.note)}</div>`;el.innerHTML=h}catch(e){el.style.display='';el.innerHTML='<div class="mut">🌡️ 温度读取失败</div>'}}
|
||||||
|
async function cpuAdvise(){const el=document.getElementById('cpuadvise');const now=Date.now();if(now-lastAdvise<15000){if(el.innerHTML)el.style.display='';return;}lastAdvise=now;try{const r=await fetch('/api/cpu/advise');const j=await r.json();const col=j.level==='轻松'||j.level==='正常'?'#20a53a':(j.level==='偏高'?'#ff9900':'#f00');document.getElementById('cpuadvise').style.display='';document.getElementById('cpuadvise').innerHTML=`<div class="model">📊 负载诊断:<b style="color:${col}">${j.level}</b> <span class="mut">(1分钟负载 ${j.load[0]} ÷ ${j.logical}核 = 单核 ${j.per_core})</span></div><div style="margin:4px 0">${esc(j.verdict)}</div><div class="mut">如何更流畅:</div><div>${j.tips.map(t=>`<div>· ${esc(t)}</div>`).join('')}</div><div style="margin-top:6px"><button class="bigbtn" id="optBtn" onclick="optimizeSys()">🚀 一键优化系统</button> <button id="optStopBtn" onclick="stopOpt()" style="display:none;background:#f00;color:#fff;border:none;border-radius:3px;padding:6px 14px;cursor:pointer">⏹ 停止</button><div class="mut" id="optDesc" style="margin-top:4px">会做两件事:① 把内存里暂存的数据写回硬盘(sync,防断电丢数据);② 回收系统缓存占用的内存(drop caches,只清缓存、不动正在运行的程序)。全程不重启、不杀进程,页面照常刷新。</div><div class="mut" id="optStatus"></div></div>`;restoreOptUI()}catch(e){}}
|
||||||
async function kill(pid,name){if(!confirm('结束进程 '+name+' (PID '+pid+') ?'))return;const r=await fetch('/api/kill',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({pid})});const j=await r.json();alert(j.ok?'已发送结束信号':('失败: '+j.error));load(true)}
|
async function kill(pid,name){if(!confirm('结束进程 '+name+' (PID '+pid+') ?'))return;const r=await fetch('/api/kill',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({pid})});const j=await r.json();alert(j.ok?'已发送结束信号':('失败: '+j.error));load(true)}
|
||||||
|
const PERF_DESC={powersave:'省电模式:限制睿频、能效优先,适合7×24待机/下载机,功耗噪音最低',balanced:'平衡模式:按负载自动升降频,日常使用推荐,性能功耗兼顾',performance:'高性能模式:火力全开,适合转码/编译/虚拟机等重负载,功耗温度最高'};
|
||||||
|
let perfCur='';
|
||||||
|
async function cpuPerf(){const el=document.getElementById('cpuperf');try{const r=await fetch('/api/cpu/perf');const j=await r.json();const m=j.mode||j.saved||'balanced';const key=m+'|'+(j.governor||'')+'|'+(j.epp||'');if(perfCur===key&&el.innerHTML){el.style.display='';return;}perfCur=key;el.style.display='';el.innerHTML=`<div class="model">⚡ 系统性能:<b>${m==='powersave'?'省电模式':m==='performance'?'高性能模式':'平衡模式'}</b> <span class="mut">(governor=${esc(j.governor||'-')} epp=${esc(j.epp||'-')},不重启电脑)</span></div><div style="margin-top:6px">${['powersave','balanced','performance'].map(k=>`<button class="perfbtn${m===k?' cur':''}" onclick="setPerf('${k}')">${k==='powersave'?'🌱 省电模式':k==='balanced'?'⚖️ 平衡模式':'🔥 高性能模式'}</button>`).join('')}</div><div class="mut" style="margin-top:6px">${PERF_DESC[m]||''}</div><div id="perfMsg" class="mut" style="margin-top:4px"></div>`}catch(e){}}
|
||||||
|
async function setPerf(mode){const msg=document.getElementById('perfMsg');if(msg)msg.textContent='⏳ 正在切换…';try{const r=await fetch('/api/cpu/perf',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({mode})});const j=await r.json();if(!j.ok){if(msg)msg.textContent='❌ 切换失败:'+(j.error||'未知错误');else alert('切换失败: '+(j.error||'未知'));return}cpuPerf()}catch(e){if(msg)msg.textContent='❌ 切换失败:网络错误'}}
|
||||||
function cmpVal(p,key){
|
function cmpVal(p,key){
|
||||||
if(key==='name')return String(p.name||'');
|
if(key==='name')return String(p.name||'');
|
||||||
if(key==='desc')return String(p.desc||'');
|
if(key==='desc')return String(p.desc||'');
|
||||||
@@ -125,7 +159,7 @@ function renderHeader(){
|
|||||||
}
|
}
|
||||||
function sortBy(key){
|
function sortBy(key){
|
||||||
if(sortState.key===key) sortState.dir*=-1; else {sortState.key=key;sortState.dir=-1;}
|
if(sortState.key===key) sortState.dir*=-1; else {sortState.key=key;sortState.dir=-1;}
|
||||||
renderHeader(); renderBody();
|
saveSort();renderHeader(); renderBody();
|
||||||
}
|
}
|
||||||
async function load(manual){
|
async function load(manual){
|
||||||
document.getElementById('disks').innerHTML='';
|
document.getElementById('disks').innerHTML='';
|
||||||
@@ -137,12 +171,13 @@ document.getElementById('ts').textContent='更新于 '+new Date().toLocaleTimeSt
|
|||||||
const S=document.getElementById('summary'),H=document.getElementById('thead'),B=document.getElementById('tbody');
|
const S=document.getElementById('summary'),H=document.getElementById('thead'),B=document.getElementById('tbody');
|
||||||
if(cur==='cpu'){
|
if(cur==='cpu'){
|
||||||
S.innerHTML=`<div class="stat"><div class="k">CPU占用</div><div class="v green">${j.cpu}%</div></div><div class="stat"><div class="k">活跃进程数</div><div class="v green">${j.active}</div></div><div class="stat"><div class="k">负载(1分钟,5分钟,15分钟)</div><div class="v num">${j.load.join(', ')}</div></div>`;
|
S.innerHTML=`<div class="stat"><div class="k">CPU占用</div><div class="v green">${j.cpu}%</div></div><div class="stat"><div class="k">活跃进程数</div><div class="v green">${j.active}</div></div><div class="stat"><div class="k">负载(1分钟,5分钟,15分钟)</div><div class="v num">${j.load.join(', ')}</div></div>`;
|
||||||
const I=j.info||{},P=j.percpu||[];
|
const I=j.info||{},P=j.percpu||[],MHZ=j.mhz||[];
|
||||||
document.getElementById('cpuinfo').style.display='';
|
document.getElementById('cpuinfo').style.display='';
|
||||||
document.getElementById('cpuinfo').innerHTML=`<div class="model">${esc(I.model||'未知CPU')} <span class="mut">${esc(I.arch||'')}</span></div><div>物理 ${I.physical||'-'} 核 / 逻辑 ${I.logical||'-'} 核 · ${I.sockets?('共 '+I.sockets+' 路 × '+I.cores_per_socket+'核 × '+I.threads_per_core+'线程'):''} · 当前 ${I.freq_cur||'-'} MHz(${I.freq_min||'-'} ~ ${I.freq_max||'-'} MHz)</div><div class="mut">L1d ${esc(I.l1d||'-')} · L1i ${esc(I.l1i||'-')} · L2 ${esc(I.l2||'-')} · L3 ${esc(I.l3||'-')}</div><div class="corebar">${P.map((v,i)=>`<div class="corecell"><div class="cb"><i style="width:${Math.min(v,100)}%"></i></div><div class="ct">#${i} ${v}%</div></div>`).join('')}</div>`;
|
document.getElementById('cpuinfo').innerHTML=`<div class="model">${esc(I.model||'未知CPU')} <span class="mut">${esc(I.arch||'')}</span></div><div>物理 ${I.physical||'-'} 核 / 逻辑 ${I.logical||'-'} 核 · ${I.sockets?('共 '+I.sockets+' 路 × '+I.cores_per_socket+'核 × '+I.threads_per_core+'线程'):''} · 当前 ${I.freq_cur||'-'} MHz(${I.freq_min||'-'} ~ ${I.freq_max||'-'} MHz)</div><div class="mut">L1d ${esc(I.l1d||'-')} · L1i ${esc(I.l1i||'-')} · L2 ${esc(I.l2||'-')} · L3 ${esc(I.l3||'-')}</div><div class="corebar">${P.map((v,i)=>`<div class="corecell"><div class="cb"><i style="width:${Math.min(v,100)}%"></i></div><div class="ct">#${i} ${v}%${MHZ[i]!=null?'<br>'+MHZ[i]+'MHz':''}</div></div>`).join('')}</div>`;
|
||||||
document.getElementById('sub').textContent=`共 ${j.total} 个进程,显示占用最高的前 ${j.items.length} 个(进程CPU为单进程占用,单核满=100%,16核满=1600%,进程之和÷16≈整机占用)`;
|
document.getElementById('sub').textContent=`共 ${j.total} 个进程,显示占用最高的前 ${j.items.length} 个(进程CPU为单进程占用,单核满=100%,16核满=1600%,进程之和÷16≈整机占用)`;
|
||||||
|
cpuPerf();cpuAdvise();cpuSensor();showBench('cpu');
|
||||||
renderHeader();
|
renderHeader();
|
||||||
B.innerHTML=j.items.map(p=>`<tr><td><a class="proc">${esc(p.name)}</a></td><td class="num">${p.cpu}</td><td class="num">${p.threads}</td><td class="num">${p.pid}</td><td>${esc(p.desc)}</td><td>${esc(p.user)}</td><td class="${p.active?'st-run':'st-sleep'}">${p.status}</td><td><button class="kill" onclick="kill(${p.pid},'${esc(p.name)}')">结束</button></td></tr>`).join('');
|
renderBody();
|
||||||
}else if(cur==='mem'){
|
}else if(cur==='mem'){
|
||||||
S.innerHTML=`<div class="stat"><div class="k">内存占用</div><div class="v green">${j.percent}%</div></div><div class="stat"><div class="k">已用 / 总共</div><div class="v num">${fmtB(j.used)} / ${fmtB(j.total)}</div></div><div class="stat"><div class="k">可用 / Swap</div><div class="v num">${fmtB(j.available)} / ${fmtB(j.swap_used)}/${fmtB(j.swap_total)} (Swap ${j.swap_percent||0}%)</div></div><div class="stat"><div class="k">操作</div><div class="v"><button class="bigbtn" onclick="dropMem()">🧹 一键回收未使用的内存</button></div></div>`;
|
S.innerHTML=`<div class="stat"><div class="k">内存占用</div><div class="v green">${j.percent}%</div></div><div class="stat"><div class="k">已用 / 总共</div><div class="v num">${fmtB(j.used)} / ${fmtB(j.total)}</div></div><div class="stat"><div class="k">可用 / Swap</div><div class="v num">${fmtB(j.available)} / ${fmtB(j.swap_used)}/${fmtB(j.swap_total)} (Swap ${j.swap_percent||0}%)</div></div><div class="stat"><div class="k">操作</div><div class="v"><button class="bigbtn" onclick="dropMem()">🧹 一键回收未使用的内存</button></div></div>`;
|
||||||
const D=j.detail||{},H2=j.hw||{},DM=H2.dimms||[];
|
const D=j.detail||{},H2=j.hw||{},DM=H2.dimms||[];
|
||||||
@@ -151,16 +186,17 @@ document.getElementById('meminfo').style.display='';
|
|||||||
document.getElementById('meminfo').innerHTML=`<div class="model">物理 ${fmtB(H2.installed||0)}(${DM.length} 条) · 系统可用 ${fmtB(H2.system_total||j.total)} · 预留 ${fmtB(H2.reserved||0)}(核显 ${fmtB(H2.vram||0)} + BIOS/PCI 保留)</div>`
|
document.getElementById('meminfo').innerHTML=`<div class="model">物理 ${fmtB(H2.installed||0)}(${DM.length} 条) · 系统可用 ${fmtB(H2.system_total||j.total)} · 预留 ${fmtB(H2.reserved||0)}(核显 ${fmtB(H2.vram||0)} + BIOS/PCI 保留)</div>`
|
||||||
+(DM.length?`<div class="mut">槽位:</div><div>${DM.map(d=>row(esc((d.locator||'')+' / '+(d.bank||'')), esc(fmtB(d.size_b)+' '+d.type+' '+(d.cspeed||d.speed||'')+'MT/s '+(d.maker||'')+' '+(d.part||'')))).join('')}</div>`:`<div class="mut">未读到内存槽位表(DMI 不可用)</div>`)
|
+(DM.length?`<div class="mut">槽位:</div><div>${DM.map(d=>row(esc((d.locator||'')+' / '+(d.bank||'')), esc(fmtB(d.size_b)+' '+d.type+' '+(d.cspeed||d.speed||'')+'MT/s '+(d.maker||'')+' '+(d.part||'')))).join('')}</div>`:`<div class="mut">未读到内存槽位表(DMI 不可用)</div>`)
|
||||||
+`<div class="mut">占用拆解:</div><div>${row('空闲 MemFree',fmtB(D.MemFree))+row('可用 MemAvailable',fmtB(D.MemAvailable))+row('缓冲 Buffers',fmtB(D.Buffers))+row('缓存 Cached',fmtB(D.Cached))+row('Swap缓存',fmtB(D.SwapCached))+row('匿名页 AnonPages',fmtB(D.AnonPages))+row('映射 Mapped',fmtB(D.Mapped))+row('共享 Shmem',fmtB(D.Shmem))+row('Slab',fmtB(D.Slab))+row('可回收',fmtB(D.SReclaimable))+row('不可回收',fmtB(D.SUnreclaim))+row('页表',fmtB(D.PageTables))+row('内核栈',fmtB(D.KernelStack))+row('已提交',fmtB(D.Committed_AS))+row('提交上限',fmtB(D.CommitLimit))+row('脏页',fmtB(D.Dirty))}</div>`;
|
+`<div class="mut">占用拆解:</div><div>${row('空闲 MemFree',fmtB(D.MemFree))+row('可用 MemAvailable',fmtB(D.MemAvailable))+row('缓冲 Buffers',fmtB(D.Buffers))+row('缓存 Cached',fmtB(D.Cached))+row('Swap缓存',fmtB(D.SwapCached))+row('匿名页 AnonPages',fmtB(D.AnonPages))+row('映射 Mapped',fmtB(D.Mapped))+row('共享 Shmem',fmtB(D.Shmem))+row('Slab',fmtB(D.Slab))+row('可回收',fmtB(D.SReclaimable))+row('不可回收',fmtB(D.SUnreclaim))+row('页表',fmtB(D.PageTables))+row('内核栈',fmtB(D.KernelStack))+row('已提交',fmtB(D.Committed_AS))+row('提交上限',fmtB(D.CommitLimit))+row('脏页',fmtB(D.Dirty))}</div>`;
|
||||||
|
showBench('mem');
|
||||||
document.getElementById('sub').textContent=`按内存占用排序,前 ${j.items.length} 个进程`;
|
document.getElementById('sub').textContent=`按内存占用排序,前 ${j.items.length} 个进程`;
|
||||||
renderHeader();
|
renderHeader();
|
||||||
B.innerHTML=j.items.map(p=>`<tr><td><a class="proc">${esc(p.name)}</a></td><td class="num">${fmtB(p.rss)}</td><td class="num">${fmtB(p.uss)}</td><td class="num">${fmtB(p.swap)}</td><td class="num">${p.pid}</td><td>${esc(p.desc)}</td><td>${esc(p.user)}</td><td class="${p.active?'st-run':'st-sleep'}">${p.status}</td><td><button class="kill" onclick="kill(${p.pid},'${esc(p.name)}')">结束</button></td></tr>`).join('');
|
renderBody();
|
||||||
}else if(cur==='disk'){
|
}else if(cur==='disk'){
|
||||||
let tot=0,used=0;j.parts.forEach(p=>{tot+=p.total;used+=p.used});
|
let tot=0,used=0;j.parts.forEach(p=>{tot+=p.total;used+=p.used});
|
||||||
const pct=tot?Math.round(used/tot*100):0;
|
const pct=tot?Math.round(used/tot*100):0;
|
||||||
S.innerHTML=`<div class="stat"><div class="k">磁盘占用</div><div class="v green">${pct}%</div></div><div class="stat"><div class="k">已用 / 总共</div><div class="v num">${fmtB(used)} / ${fmtB(tot)}</div></div><div class="stat"><div class="k">读 / 写累计</div><div class="v num">${fmtB(j.io.read||0)} / ${fmtB(j.io.write||0)}</div></div>`;
|
S.innerHTML=`<div class="stat"><div class="k">磁盘占用</div><div class="v green">${pct}%</div></div><div class="stat"><div class="k">已用 / 总共</div><div class="v num">${fmtB(used)} / ${fmtB(tot)}</div></div><div class="stat"><div class="k">读 / 写累计</div><div class="v num">${fmtB(j.io.read||0)} / ${fmtB(j.io.write||0)}</div></div>`;
|
||||||
document.getElementById('sub').textContent=`${j.parts.length} 个挂载点,下表按 IO 占用排序`;
|
document.getElementById('sub').textContent=`${j.parts.length} 个挂载点,下表按 IO 占用排序`;
|
||||||
renderHeader();
|
renderHeader();
|
||||||
B.innerHTML=j.items.map(p=>`<tr><td><a class="proc">${esc(p.name)}</a></td><td class="num">${fmtB(p.io_r)}</td><td class="num">${fmtB(p.io_w)}</td><td class="num">${p.pid}</td><td>${esc(p.user)}</td><td class="${p.active?'st-run':'st-sleep'}">${p.status}</td><td><button class="kill" onclick="kill(${p.pid},'${esc(p.name)}')">结束</button></td></tr>`).join('');
|
renderBody();
|
||||||
document.getElementById('disks').innerHTML=j.parts.map(p=>`<div class="diskrow"><div class="t">${esc(p.mount)} <span class="mut">${esc(p.device)} ${esc(p.fstype)}</span></div><div class="num">${fmtB(p.used)} / ${fmtB(p.total)} (${p.percent}%) · 可用 ${fmtB(p.free)}</div><div class="bar"><i style="width:${p.percent}%"></i></div></div>`).join('');
|
document.getElementById('disks').innerHTML=j.parts.map(p=>`<div class="diskrow"><div class="t">${esc(p.mount)} <span class="mut">${esc(p.device)} ${esc(p.fstype)}</span></div><div class="num">${fmtB(p.used)} / ${fmtB(p.total)} (${p.percent}%) · 可用 ${fmtB(p.free)}</div><div class="bar"><i style="width:${p.percent}%"></i></div></div>`).join('');
|
||||||
const W=j.hw||{},DS=W.disks||[],AR=W.arrays||[],EX=W.extra||{};
|
const W=j.hw||{},DS=W.disks||[],AR=W.arrays||[],EX=W.extra||{};
|
||||||
const drow=(k,v)=>`<span style="display:inline-block;min-width:250px;margin-right:12px">${k} <b class="num">${v}</b></span>`;
|
const drow=(k,v)=>`<span style="display:inline-block;min-width:250px;margin-right:12px">${k} <b class="num">${v}</b></span>`;
|
||||||
@@ -169,12 +205,13 @@ document.getElementById('diskinfo').innerHTML=`<div class="model">共 ${DS.lengt
|
|||||||
+(DS.length?DS.map(d=>`<div style="margin-top:8px;padding-top:8px;border-top:1px dashed #eee"><div><b>/dev/${esc(d.name||'')}</b> ${esc(d.model||d.sys_model||'')} <span class="mut">${esc(d.type||'')} · ${fmtB(d.cap_b)} · ${esc(d.iface||'')}</span> <span style="color:${String(d.health||'').includes('PASSED')?'#20a53a':'#f00'}">${esc(d.health||'')}</span></div><div>${drow('序列号',esc(d.serial||'-'))+drow('温度',d.temp_c!=null?(d.temp_c+'°C 快照'):'-')+drow('通电',d.hours!=null?(Math.floor(d.hours/24)+' 天('+d.hours+' 小时)'):'-')+drow('通电次数',d.power_cycles!=null?d.power_cycles:'-')+drow('坏道重映射',d.realloc!=null?d.realloc:'-')+(d.wear!=null?drow('磨损',d.wear+'%'):'')+(d.helium!=null?drow('氦气',d.helium+'%'):'')+(d.rpm?drow('转速',d.rpm+' 转'):drow('转速',d.rotational?'机械':'固态'))+drow('尺寸',esc(d.form||'-'))+drow('读写累计',fmtB(d.io_read||0)+' / '+fmtB(d.io_write||0))}</div></div>`).join(''):`<div class="mut">未读到硬盘信息</div>`)
|
+(DS.length?DS.map(d=>`<div style="margin-top:8px;padding-top:8px;border-top:1px dashed #eee"><div><b>/dev/${esc(d.name||'')}</b> ${esc(d.model||d.sys_model||'')} <span class="mut">${esc(d.type||'')} · ${fmtB(d.cap_b)} · ${esc(d.iface||'')}</span> <span style="color:${String(d.health||'').includes('PASSED')?'#20a53a':'#f00'}">${esc(d.health||'')}</span></div><div>${drow('序列号',esc(d.serial||'-'))+drow('温度',d.temp_c!=null?(d.temp_c+'°C 快照'):'-')+drow('通电',d.hours!=null?(Math.floor(d.hours/24)+' 天('+d.hours+' 小时)'):'-')+drow('通电次数',d.power_cycles!=null?d.power_cycles:'-')+drow('坏道重映射',d.realloc!=null?d.realloc:'-')+(d.wear!=null?drow('磨损',d.wear+'%'):'')+(d.helium!=null?drow('氦气',d.helium+'%'):'')+(d.rpm?drow('转速',d.rpm+' 转'):drow('转速',d.rotational?'机械':'固态'))+drow('尺寸',esc(d.form||'-'))+drow('读写累计',fmtB(d.io_read||0)+' / '+fmtB(d.io_write||0))}</div></div>`).join(''):`<div class="mut">未读到硬盘信息</div>`)
|
||||||
+(AR.length?`<div class="mut" style="margin-top:8px">阵列拓扑(单成员 RAID1,无冗余):</div><div>${AR.map(a=>drow(esc(a.md+' → '+(a.mount||'')),esc((a.level||'')+' '+(a.members||'')+' '+(a.live_status||'')+' '+(a.live_devs||'')))).join('')+(AR.some(a=>a.live_sync)?`<div class="mut">${esc((AR.find(a=>a.live_sync)||{}).live_sync||'')}</div>`:''+(EX&&EX.mount?`<div>${drow('系统盘 '+esc(EX.mount||'/'),esc((EX.part||'')+'('+(EX.note||'')+')'))}</div>`:''))}</div>`:'')
|
+(AR.length?`<div class="mut" style="margin-top:8px">阵列拓扑(单成员 RAID1,无冗余):</div><div>${AR.map(a=>drow(esc(a.md+' → '+(a.mount||'')),esc((a.level||'')+' '+(a.members||'')+' '+(a.live_status||'')+' '+(a.live_devs||'')))).join('')+(AR.some(a=>a.live_sync)?`<div class="mut">${esc((AR.find(a=>a.live_sync)||{}).live_sync||'')}</div>`:''+(EX&&EX.mount?`<div>${drow('系统盘 '+esc(EX.mount||'/'),esc((EX.part||'')+'('+(EX.note||'')+')'))}</div>`:''))}</div>`:'')
|
||||||
+((W.note)?`<div class="mut">${esc(W.note)}</div>`:'');
|
+((W.note)?`<div class="mut">${esc(W.note)}</div>`:'');
|
||||||
|
showBench('disk');
|
||||||
}else{
|
}else{
|
||||||
const up=j.nics.reduce((a,n)=>a+n.up,0),down=j.nics.reduce((a,n)=>a+n.down,0);
|
const up=j.nics.reduce((a,n)=>a+n.up,0),down=j.nics.reduce((a,n)=>a+n.down,0);
|
||||||
S.innerHTML=`<div class="stat"><div class="k">上行速率</div><div class="v green">${fmtR(up)}</div></div><div class="stat"><div class="k">下行速率</div><div class="v green">${fmtR(down)}</div></div><div class="stat"><div class="k">累计接收</div><div class="v num">${fmtB(j.total_recv||0)}</div></div><div class="stat"><div class="k">累计发送</div><div class="v num">${fmtB(j.total_sent||0)}</div></div><div class="stat"><div class="k">连接数</div><div class="v num">${j.conns}</div></div>`;
|
S.innerHTML=`<div class="stat"><div class="k">上行速率</div><div class="v green">${fmtR(up)}</div></div><div class="stat"><div class="k">下行速率</div><div class="v green">${fmtR(down)}</div></div><div class="stat"><div class="k">累计接收</div><div class="v num">${fmtB(j.total_recv||0)}</div></div><div class="stat"><div class="k">累计发送</div><div class="v num">${fmtB(j.total_sent||0)}</div></div><div class="stat"><div class="k">连接数</div><div class="v num">${j.conns}</div></div>`;
|
||||||
document.getElementById('sub').textContent=j.nics.map(n=>`${n.nic}: ↑${fmtR(n.up)} ↓${fmtR(n.down)}`).join(' · ')||'无网卡数据';
|
document.getElementById('sub').textContent=j.nics.map(n=>`${n.nic}: ↑${fmtR(n.up)} ↓${fmtR(n.down)}`).join(' · ')||'无网卡数据';
|
||||||
renderHeader();
|
renderHeader();
|
||||||
B.innerHTML=j.items.map(p=>`<tr><td><a class="proc">${esc(p.name)}</a></td><td class="num">${p.conns}</td><td class="num">${p.pid}</td><td>${esc(p.desc)}</td><td>${esc(p.user)}</td><td class="${p.active?'st-run':'st-sleep'}">${p.status}</td><td><button class="kill" onclick="kill(${p.pid},'${esc(p.name)}')">结束</button></td></tr>`).join('');
|
renderBody();
|
||||||
document.getElementById('netextra').innerHTML=`<h3 style="margin:12px 0 4px">TCP连接</h3><table class="t"><thead><tr><th>进程名</th><th>本地地址</th><th>远程地址</th><th>地址族</th><th>PID</th><th>状态</th></tr></thead><tbody>${(j.tcp||[]).map(c=>`<tr><td>${esc(c.name)}</td><td class="num">${esc(c.laddr)}</td><td class="num">${esc(c.raddr)}</td><td>${esc(c.family)}</td><td class="num">${c.pid||''}</td><td>${esc(c.status)}</td></tr>`).join('')}</tbody></table><h3 style="margin:12px 0 4px">侦听端口</h3><table class="t"><thead><tr><th>进程名</th><th>监听地址</th><th>端口</th><th>地址族</th><th>防火墙</th><th>PID</th><th>协议</th></tr></thead><tbody>${(j.listen||[]).map(c=>`<tr><td>${esc(c.name)}</td><td class="num">${esc(c.laddr)}</td><td class="num">${c.port}</td><td>${esc(c.family)}</td><td>不放行</td><td class="num">${c.pid||''}</td><td>${esc(c.proto)}</td></tr>`).join('')}</tbody></table>`;
|
document.getElementById('netextra').innerHTML=`<h3 style="margin:12px 0 4px">TCP连接</h3><table class="t"><thead><tr><th>进程名</th><th>本地地址</th><th>远程地址</th><th>地址族</th><th>PID</th><th>状态</th></tr></thead><tbody>${(j.tcp||[]).map(c=>`<tr><td>${esc(c.name)}</td><td class="num">${esc(c.laddr)}</td><td class="num">${esc(c.raddr)}</td><td>${esc(c.family)}</td><td class="num">${c.pid||''}</td><td>${esc(c.status)}</td></tr>`).join('')}</tbody></table><h3 style="margin:12px 0 4px">侦听端口</h3><table class="t"><thead><tr><th>进程名</th><th>监听地址</th><th>端口</th><th>地址族</th><th>防火墙</th><th>PID</th><th>协议</th></tr></thead><tbody>${(j.listen||[]).map(c=>`<tr><td>${esc(c.name)}</td><td class="num">${esc(c.laddr)}</td><td class="num">${c.port}</td><td>${esc(c.family)}</td><td>不放行</td><td class="num">${c.pid||''}</td><td>${esc(c.proto)}</td></tr>`).join('')}</tbody></table>`;
|
||||||
const NW=j.hw||{},NN=NW.nics||[];
|
const NW=j.hw||{},NN=NW.nics||[];
|
||||||
const nrow=(k,v)=>`<span style="display:inline-block;min-width:260px;margin-right:12px">${k} <b class="num">${v}</b></span>`;
|
const nrow=(k,v)=>`<span style="display:inline-block;min-width:260px;margin-right:12px">${k} <b class="num">${v}</b></span>`;
|
||||||
@@ -183,10 +220,32 @@ document.getElementById('netinfo').style.display='';
|
|||||||
document.getElementById('netinfo').innerHTML=`<div class="model">出口 ${esc(NW.egress||'-')} · 网关 ${esc(NW.gateway||'-')} · DNS ${esc(NW.dns||'-')} <span class="mut">共 ${NN.length} 块网卡(档案快照 ${esc(NW.snapshot||'')},地址/状态/速率为实时)</span></div>`
|
document.getElementById('netinfo').innerHTML=`<div class="model">出口 ${esc(NW.egress||'-')} · 网关 ${esc(NW.gateway||'-')} · DNS ${esc(NW.dns||'-')} <span class="mut">共 ${NN.length} 块网卡(档案快照 ${esc(NW.snapshot||'')},地址/状态/速率为实时)</span></div>`
|
||||||
+(NN.length?NN.map(n=>`<div style="margin-top:8px;padding-top:8px;border-top:1px dashed #eee"><div><b>${esc(n.name||'')}</b> ${esc(n.model||'')} <span class="mut">${esc(n.role||'')}</span> <span style="color:${(n.isup===false||n.operstate==='down')?'#999':'#20a53a'}">${esc(n.operstate||(n.isup===false?'down':'up'))}</span></div><div>${nrow('IPv4',esc((n.ipv4||[]).join(' / ')||'-'))+nrow('IPv6',esc((n.ipv6||[]).join(' / ')||'-'))+nrow('MAC',esc(n.address||n.mac||'-'))+nrow('协商速率',spd(n.speed||n.live_speed))+nrow('双工',esc(n.duplex||'-'))+nrow('MTU',esc(n.mtu||n.live_mtu||'-'))+nrow('驱动',esc(n.live_driver||n.driver||'-'))+(n.pci?nrow('PCI',esc(n.pci)):'')+(n.ssid?nrow('WiFi',esc(n.ssid)):'')+nrow('收发累计',fmtB(n.io_recv||0)+' / '+fmtB(n.io_sent||0))}</div></div>`).join(''):`<div class="mut">未读到网卡信息</div>`)
|
+(NN.length?NN.map(n=>`<div style="margin-top:8px;padding-top:8px;border-top:1px dashed #eee"><div><b>${esc(n.name||'')}</b> ${esc(n.model||'')} <span class="mut">${esc(n.role||'')}</span> <span style="color:${(n.isup===false||n.operstate==='down')?'#999':'#20a53a'}">${esc(n.operstate||(n.isup===false?'down':'up'))}</span></div><div>${nrow('IPv4',esc((n.ipv4||[]).join(' / ')||'-'))+nrow('IPv6',esc((n.ipv6||[]).join(' / ')||'-'))+nrow('MAC',esc(n.address||n.mac||'-'))+nrow('协商速率',spd(n.speed||n.live_speed))+nrow('双工',esc(n.duplex||'-'))+nrow('MTU',esc(n.mtu||n.live_mtu||'-'))+nrow('驱动',esc(n.live_driver||n.driver||'-'))+(n.pci?nrow('PCI',esc(n.pci)):'')+(n.ssid?nrow('WiFi',esc(n.ssid)):'')+nrow('收发累计',fmtB(n.io_recv||0)+' / '+fmtB(n.io_sent||0))}</div></div>`).join(''):`<div class="mut">未读到网卡信息</div>`)
|
||||||
+((NW.note)?`<div class="mut">${esc(NW.note)}</div>`:'');
|
+((NW.note)?`<div class="mut">${esc(NW.note)}</div>`:'');
|
||||||
|
showBench('net');
|
||||||
}
|
}
|
||||||
}catch(e){if(manual)alert('加载失败: '+e)}
|
}catch(e){if(manual)alert('加载失败: '+e)}
|
||||||
}
|
}
|
||||||
load(true);setInterval(()=>load(false),3000);
|
const BENCH_TXT={cpu:['🏃 系统运行速度测试','20万次整数运算,分数越高越快;自动记录当前性能模式/governor/平均MHz,方便对比省电/平衡/高性能三档效果','预计约1秒'],mem:['💾 内存读写测速','32MB内存写入/读取,测完即释放,不占内存','预计约1秒'],disk:['💽 硬盘读写测速','32MB临时文件写(含落盘)/读,测完自动删除,不占空间','预计约1~3秒'],net:['🌐 网络上下行测速','Cloudflare测速点:下行5MB/上行2MB','预计约5~15秒(看网速)']};
|
||||||
|
function benchHist(k){try{return JSON.parse(localStorage.getItem('fnos_bench_'+k)||'[]')}catch(e){return[]}}
|
||||||
|
function benchPush(k,t){try{const h=benchHist(k);h.unshift(t);localStorage.setItem('fnos_bench_'+k,JSON.stringify(h.slice(0,5)))}catch(e){}}
|
||||||
|
function renderBench(k,msg){const el=document.getElementById(k+'bench');if(!el)return;const T=BENCH_TXT[k],h=benchHist(k);el.innerHTML='<div class="model">'+T[0]+' <span class="mut">⏱ '+T[2]+'</span></div><div class="mut">'+T[1]+'</div><div style="margin-top:6px"><button class="benchbtn" id="benchbtn_'+k+'" onclick="runBench(\''+k+'\')">开始测速('+T[2]+')</button> <span id="benchmsg_'+k+'" class="mut">'+(msg||'')+'</span></div>'+(h.length?'<div class="benchhist">历史记录(最多5条,超出自动删旧):<br>'+h.map(x=>esc(x)).join('<br>')+'</div>':'<div class="benchhist">暂无测速记录,点「开始测速」跑一次</div>')}
|
||||||
|
function showBench(k){const el=document.getElementById(k+'bench');if(!el)return;el.style.display='';if(!el.innerHTML)renderBench(k)}
|
||||||
|
async function runBench(k){const b=document.getElementById('benchbtn_'+k),m=document.getElementById('benchmsg_'+k);if(b){b.disabled=true;b.textContent='测速中…'}if(m)m.textContent='正在测速,请稍候('+BENCH_TXT[k][2]+')';try{const r=await fetch('/api/bench/'+k,{method:'POST'});const j=await r.json();let line='';if(j.ok){if(k==='cpu')line=j.at+' ['+j.mode+'|'+(j.governor||'-')+'] '+j.ms+'ms '+j.kops+'kops AVG'+j.mhz_avg+'MHz';else if(k==='mem')line=j.at+' W'+j.write_mbs+'MB/s R'+j.read_mbs+'MB/s';else if(k==='disk')line=j.at+' W'+j.write_mbs+'MB/s R'+j.read_mbs+'MB/s '+(j.file||'');else if(k==='net')line=j.at+' DOWN'+j.down_mbps+'Mbps'+(j.up_mbps?' UP'+j.up_mbps+'Mbps':' UPFAIL');benchPush(k,line);renderBench(k,'OK '+line)}else renderBench(k,'FAIL '+(j.error||'ERR'))}catch(e){renderBench(k,'FAIL '+e)}}
|
||||||
|
load(true);
|
||||||
|
let ivalSec=3,timer=null,paused=false;
|
||||||
|
function startTimer(){if(timer)clearInterval(timer);if(!paused)timer=setInterval(()=>load(false),ivalSec*1000)}
|
||||||
|
function setIval(v){ivalSec=+v;startTimer()}
|
||||||
|
function togglePause(){paused=!paused;document.getElementById('pauseBtn').textContent=paused?'▶ 恢复刷新':'⏸ 停止刷新';startTimer()}
|
||||||
|
startTimer();
|
||||||
|
async function licPoll(){try{const r=await fetch('/api/license-config',{cache:'no-store'});const j=await r.json();LIC=j;
|
||||||
|
const dot=document.getElementById('licDot');if(dot)dot.style.display=(j.announcements&&j.announcements.length)?'':'none';
|
||||||
|
const v=document.getElementById('licVer');if(v)v.textContent='v'+(j.version||'1.3.15')+(j.update_available?' ●':'');
|
||||||
|
if(j.popup&&j.popup.length){try{const seen=JSON.parse(localStorage.getItem('fnos_ann_seen')||'[]');const fresh=j.popup.filter(a=>seen.indexOf(a.id)<0);if(fresh.length){const a=fresh[0];const el=document.getElementById('annPop');el.innerHTML=`<div style="display:flex;justify-content:space-between;align-items:center"><b>📢 ${esc(a.title||'公告')}</b><span onclick="dismissPop(${a.id})" style="cursor:pointer;color:#999">✕</span></div><div style="margin-top:6px">${a.content||''}</div>`;el.style.display='';}}catch(e){}}
|
||||||
|
if(document.getElementById('annPanel').style.display!=='none')renderAnn();}catch(e){}}
|
||||||
|
function renderAnn(){const el=document.getElementById('annPanel');const list=LIC.announcements||[];el.innerHTML=list.length?(`<b>📢 公告(${list.length})</b>`+list.map(a=>`<div style="margin-top:8px;padding-top:8px;border-top:1px dashed #eee"><div><b>${esc(a.title||'')}</b></div><div style="color:#666">${a.content||''}</div></div>`).join('')):'<span style="color:#999">暂无公告</span>';}
|
||||||
|
function toggleAnn(){const el=document.getElementById('annPanel');if(el.style.display==='none'){renderAnn();el.style.display=''}else el.style.display='none'}
|
||||||
|
function dismissPop(id){try{const seen=JSON.parse(localStorage.getItem('fnos_ann_seen')||'[]');seen.push(id);localStorage.setItem('fnos_ann_seen',JSON.stringify(seen))}catch(e){}document.getElementById('annPop').style.display='none'}
|
||||||
|
async function checkVer(manual){try{const r=await fetch('/api/license-config',{cache:'no-store'});const j=await r.json();LIC=j;if(j.update_available){alert('发现新版本 v'+(j.latest||'')+'\n'+(j.changelog||'')+(j.download_url?('\n下载:'+j.download_url):''))}else if(manual){alert('当前已是最新版本 v'+(j.version||''))}}catch(e){if(manual)alert('版本检查失败,稍后重试')}}
|
||||||
|
licPoll();setInterval(licPoll,10*60*1000);
|
||||||
</script>
|
</script>
|
||||||
<footer style="position:fixed;bottom:0;left:0;right:0;text-align:center;padding:6px;font-size:12px;color:#999;background:#fff;border-top:1px solid #eee;z-index:999">
|
<footer style="position:fixed;bottom:0;left:0;right:0;text-align:center;padding:6px;font-size:12px;color:#999;background:#fff;border-top:1px solid #eee;z-index:999">
|
||||||
<a href="https://nav.88531.cn" target="_blank" rel="noopener">资享导航站</a> ·
|
<a href="https://nav.88531.cn" target="_blank" rel="noopener">资享导航站</a> ·
|
||||||
|
|||||||