v0.27.3: Use real system memory everywhere, add monitoring memory bar
Deploy page, pre-start check, and deploy validation now use actual /proc/meminfo usage instead of declared mem_request sums. New GetMemoryMB() helper for lightweight real-time memory reads. Monitoring page gains a stacked memory distribution bar showing per-container usage, OS overhead, and free memory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,16 @@ func GetTotalMemoryMB() (int, error) {
|
||||
return int(info.TotalMemMB), nil
|
||||
}
|
||||
|
||||
// GetMemoryMB returns total and used system memory in MB from /proc/meminfo.
|
||||
func GetMemoryMB() (totalMB, usedMB int, err error) {
|
||||
info := SystemInfo{}
|
||||
readMemInfo(&info)
|
||||
if info.TotalMemMB == 0 {
|
||||
return 0, 0, fmt.Errorf("could not read MemTotal from /proc/meminfo")
|
||||
}
|
||||
return int(info.TotalMemMB), int(info.UsedMemMB), nil
|
||||
}
|
||||
|
||||
func readMemInfo(info *SystemInfo) {
|
||||
f, err := os.Open("/proc/meminfo")
|
||||
if err != nil {
|
||||
|
||||
@@ -13,3 +13,8 @@ func GetInfo(_ string, _ *CPUCollector) SystemInfo {
|
||||
func GetTotalMemoryMB() (int, error) {
|
||||
return 0, fmt.Errorf("/proc/meminfo not available on this platform")
|
||||
}
|
||||
|
||||
// GetMemoryMB is not available on non-Linux platforms.
|
||||
func GetMemoryMB() (totalMB, usedMB int, err error) {
|
||||
return 0, 0, fmt.Errorf("/proc/meminfo not available on this platform")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user