mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-26 05:38:46 +00: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 {
|
func GetServerMetrics() database.ServerMetric {
|
||||||
v, _ := mem.VirtualMemory()
|
v, _ := mem.VirtualMemory()
|
||||||
c, _ := cpu.Percent(0, false)
|
c, _ := cpu.Percent(time.Second, false)
|
||||||
cpuInfo, _ := cpu.Info()
|
cpuInfo, _ := cpu.Info()
|
||||||
diskInfo, _ := disk.Usage("/")
|
diskInfo, _ := disk.Usage("/")
|
||||||
netInfo, _ := net.IOCounters(false)
|
netInfo, _ := net.IOCounters(false)
|
||||||
@@ -130,7 +130,8 @@ func GetServerMetrics() database.ServerMetric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
memTotalGB := float64(v.Total) / 1024 / 1024 / 1024
|
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
|
memUsedPercent := (memUsedGB / memTotalGB) * 100
|
||||||
|
|
||||||
var networkIn, networkOut float64
|
var networkIn, networkOut float64
|
||||||
|
|||||||
Reference in New Issue
Block a user