From 8537b6fbbf0e8b847be1d29befae31a01d0e4959 Mon Sep 17 00:00:00 2001 From: CorentinMre <72888555+CorentinMre@users.noreply.github.com> Date: Sun, 12 Oct 2025 11:59:31 +0200 Subject: [PATCH] fix: use actual memory usage excluding cache/buffers in monitoring - Replace v.Used with (Total - Available) calculation - Provides accurate memory usage for monitoring alerts - Prevents false alerts caused by Linux cache/buffers - Aligns with 'free -h' available memory metric --- apps/monitoring/monitoring/monitor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/monitoring/monitoring/monitor.go b/apps/monitoring/monitoring/monitor.go index 0beb4320f..eef1e5d85 100644 --- a/apps/monitoring/monitoring/monitor.go +++ b/apps/monitoring/monitoring/monitor.go @@ -130,7 +130,8 @@ func GetServerMetrics() database.ServerMetric { } memTotalGB := float64(v.Total) / 1024 / 1024 / 1024 - memUsedGB := float64(v.Used) / 1024 / 1024 / 1024 + memAvailableGB := float64(v.Available) / 1024 / 1024 / 1024 + memUsedGB := memTotalGB - memAvailableGB memUsedPercent := (memUsedGB / memTotalGB) * 100 var networkIn, networkOut float64