mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-24 16:45:22 +02:00
Merge pull request #2810 from CorentinMre/fix/memory-monitoring-actual-usage
fix: use actual memory usage excluding cache/buffers in monitoring
This commit is contained in:
@@ -117,7 +117,7 @@ func getRealOS() string {
|
||||
|
||||
func GetServerMetrics() database.ServerMetric {
|
||||
v, _ := mem.VirtualMemory()
|
||||
c, _ := cpu.Percent(0, false)
|
||||
c, _ := cpu.Percent(time.Second, false)
|
||||
cpuInfo, _ := cpu.Info()
|
||||
diskInfo, _ := disk.Usage("/")
|
||||
netInfo, _ := net.IOCounters(false)
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user