메모리 상태 또 변경
This commit is contained in:
@@ -297,20 +297,16 @@ function isContainerChanged(serverId: number, containerName: string, metric: str
|
||||
return changedKeys.value.has(`container-${serverId}-${containerName}-${metric}`)
|
||||
}
|
||||
|
||||
// 서버 메모리 퍼센트 계산: (total - free) / total * 100
|
||||
// 서버 메모리 퍼센트: memory_percent 직접 사용
|
||||
function calcMemPercent(server: ServerStatus): number {
|
||||
const total = Number(server.memory_total) || 0
|
||||
const free = Number(server.memory_free) || 0
|
||||
if (total === 0) return 0
|
||||
return ((total - free) / total) * 100
|
||||
return server.memory_percent || 0
|
||||
}
|
||||
|
||||
// 서버 메모리 용량 포맷: used/total GB
|
||||
// 서버 메모리 용량 포맷: used/total GB (memory_used는 DB에서 계산된 값)
|
||||
function formatServerMem(server: ServerStatus): string {
|
||||
const used = Number(server.memory_used) || 0
|
||||
const total = Number(server.memory_total) || 0
|
||||
const free = Number(server.memory_free) || 0
|
||||
if (total === 0) return '-'
|
||||
const used = total - free
|
||||
const usedGB = (used / (1024 * 1024 * 1024)).toFixed(1)
|
||||
const totalGB = (total / (1024 * 1024 * 1024)).toFixed(1)
|
||||
return `${usedGB}/${totalGB}G`
|
||||
|
||||
Reference in New Issue
Block a user