Skip to content

An easy-to-use go service resource monitor, support containers.

License

Notifications You must be signed in to change notification settings

NICEXAI/go-rmonitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-rmonitor

An easy-to-use go service resource monitor, support containers.

Installation

Run the following command under your project:

go get -u github.com/NICEXAI/go-rmonitor

Available Architectures

  • Linux i386/amd64/arm(raspberry pi)
  • Windows i386/amd64/arm/arm64

Usage

Get CPU cores
package main

import (
	"github.com/NICEXAI/go-rmonitor/cpu"
	"log"
)

func main() {
	coreCount := cpu.GetCoreNum()
	log.Printf("CPU core count is: %v", coreCount)
}

See details.

Get memory stat
package main

import (
	"github.com/NICEXAI/go-rmonitor/mem"
	"log"
)

func main() {
	memStat, _ := mem.GetMemory()

	log.Printf("Totol memory is: %v", memStat.Total)
	log.Printf("Available memory is: %v", memStat.Available)
	log.Printf("Used memory is: %v", memStat.Used)
	log.Printf("Cached is: %v", memStat.Cached)
	log.Printf("UsedPercent is: %v", memStat.UsedPercent)
}

See details.

About

An easy-to-use go service resource monitor, support containers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages