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
This commit is contained in:
CorentinMre
2025-10-12 11:59:31 +02:00
parent a0b550ace9
commit 8537b6fbbf

View File

@@ -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