fix: station VPS Users/Node ハイフン・CPU リング 0% 表示修正
Made-with: Cursor
This commit is contained in:
parent
b8b8cf9c52
commit
7aa79f4a7d
|
|
@ -391,7 +391,7 @@ function updateRing(fillId,valId,pct,circ,base,warn,crit){
|
||||||
fill.style.strokeDashoffset=circ*(1-Math.min(pct,100)/100);
|
fill.style.strokeDashoffset=circ*(1-Math.min(pct,100)/100);
|
||||||
const color=pct>80?(crit||'#F87171'):pct>60?(warn||'#FB923C'):(base||'#22D3EE');
|
const color=pct>80?(crit||'#F87171'):pct>60?(warn||'#FB923C'):(base||'#22D3EE');
|
||||||
fill.style.stroke=color;
|
fill.style.stroke=color;
|
||||||
valEl.textContent=pct>0?`${pct}%`:'—';
|
valEl.textContent=`${pct}%`;
|
||||||
valEl.style.fill=pct>80?'#F87171':pct>60?'#FB923C':'var(--text)';
|
valEl.style.fill=pct>80?'#F87171':pct>60?'#FB923C':'var(--text)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -762,6 +762,11 @@ function buildRouter() {
|
||||||
const p = df.trim().split('\n')[1].split(/\s+/);
|
const p = df.trim().split('\n')[1].split(/\s+/);
|
||||||
disk = { total_gb: Math.round(parseInt(p[1])/1e9*10)/10, used_gb: Math.round(parseInt(p[2])/1e9*10)/10, use_pct: Math.round(parseInt(p[2])/parseInt(p[1])*100) };
|
disk = { total_gb: Math.round(parseInt(p[1])/1e9*10)/10, used_gb: Math.round(parseInt(p[2])/1e9*10)/10, use_pct: Math.round(parseInt(p[2])/parseInt(p[1])*100) };
|
||||||
} catch(_) {}
|
} catch(_) {}
|
||||||
|
let users = 0;
|
||||||
|
try {
|
||||||
|
const whoOut = execSync('who 2>/dev/null', { timeout: 1000 }).toString().trim();
|
||||||
|
users = whoOut ? whoOut.split('\n').filter(l => l.trim()).length : 0;
|
||||||
|
} catch(_) {}
|
||||||
res.json({
|
res.json({
|
||||||
...base,
|
...base,
|
||||||
gemini: !!genAI,
|
gemini: !!genAI,
|
||||||
|
|
@ -770,6 +775,8 @@ function buildRouter() {
|
||||||
mem_used_mb: Math.round((total - mem) / 1024 / 1024),
|
mem_used_mb: Math.round((total - mem) / 1024 / 1024),
|
||||||
mem_total_mb: Math.round(total / 1024 / 1024),
|
mem_total_mb: Math.round(total / 1024 / 1024),
|
||||||
disk,
|
disk,
|
||||||
|
users,
|
||||||
|
node_version: process.version,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue