fix: resolve loadAvg is not defined ReferenceError in updateStream
This commit is contained in:
parent
0113a5d777
commit
34f5acbbc9
|
|
@ -327,6 +327,8 @@ const hist = {cpu:[], load:[]};
|
|||
const svcHist = {};
|
||||
const svcLatHist = {};
|
||||
SERVICES.forEach(s => { svcHist[s.id] = []; svcLatHist[s.id] = []; });
|
||||
// メトリクスのグローバルキャッシュ(updateStream の setInterval から参照)
|
||||
let _metrics = { cpuPct:0, memPct:0, diskPct:0, loadAvg:[0,0,0], uptimeS:0, sessions:0, hostname:'ubuntu-pc', nodeVer:'' };
|
||||
let streamData = null;
|
||||
|
||||
function p(n){ return String(n).padStart(2,'0'); }
|
||||
|
|
@ -588,7 +590,7 @@ function updateStream(data){
|
|||
`CPU:${b8(cpuPct??0)}`,
|
||||
`MEM:${b8(memPct??0)}`,
|
||||
`DISK:${b8(diskPct??0)}`,
|
||||
`LOAD:${b8(Math.min(255,Math.round((loadAvg[0]||0)*64)))}`,
|
||||
`LOAD:${b8(Math.min(255,Math.round(((data.load_avg&&data.load_avg[0])||0)*64)))}`,
|
||||
`UP:${(data.uptime_s||0).toString(2)}`,
|
||||
`SESSION:${b8(data.active_sessions||0)}`,
|
||||
`TIME:${(Math.floor(Date.now()/1000)).toString(2).slice(-20)}`,
|
||||
|
|
|
|||
Loading…
Reference in New Issue