Populate memory load in node stats. (#1121)

This commit is contained in:
Raja Subramanian
2022-10-25 21:31:23 +05:30
committed by GitHub
parent 222ce5d1a8
commit 96a058b503
5 changed files with 37 additions and 5 deletions
+11
View File
@@ -9,6 +9,7 @@ import (
"github.com/florianl/go-tc"
"github.com/mackerelio/go-osstat/cpu"
"github.com/mackerelio/go-osstat/memory"
)
var (
@@ -36,6 +37,16 @@ func getCPUStats() (cpuLoad float32, numCPUs uint32, err error) {
return
}
func getMemoryStats() (memoryLoad float32, err error) {
memInfo, err := memory.Get()
if err != nil {
return
}
memoryLoad = float32(memInfo.Used) / float32(memInfo.Total)
return
}
func getTCStats() (packets, drops uint32, err error) {
rtnl, err := tc.Open(&tc.Config{})
if err != nil {