mackerelio / go-osstat Goto Github PK
View Code? Open in Web Editor NEWOS system statistics library for Go
License: Apache License 2.0
OS system statistics library for Go
License: Apache License 2.0
Get cpu percentage
cpu_before, _ := cpu.Get()
for {
cpu_current, _ := cpu.Get()
cpuUsage := (1.0 - float64(cpu_current.Idle-cpu_before.Idle)/float64(cpu_current.Total-cpu_before.Total)) * 100.0
if cpuUsage != cpuUsage {
cpuUsage = 0
}
fmt.Printf("CPU : %6.2f\n", cpuUsage)
cpu_before = cpu_current
time.Sleep(time.Second * 2)
}
I didn't find any reference to know the unit of memory usage. Is it in number of bytes?
./emergency-response.go:45:46: memory.Cached undefined (type *memory.Stats has no field or method Cached)
memory, err := memory.Get()
fmt.Printf("memory cached: %d GB\n", memory.Cached)
I don't see anywhere in the reference about measurement unit of ReadsCompleted and WritesCompleted fields of disk stats type. Are they read/write coumy or read/witten bytes? If they counts, is there anyway to get rKB/s and wKB/s displayed by iostat?
Hi โ
I'm using mackerel-agent(docker), and felt interface metrics are something wrong.
https://github.com/mackerelio/go-osstat/blob/master/network/network_linux.go#L17
Does mackerel-agent(docker) reads procfs on the container? But I'd like it to read the value on host machine. My mackerel-agent doesn't mount host's /proc though..
When I try to build with the disk package I'm getting error:
package command-line-arguments
imports poc/scripts/qps-scenario/scenario
imports github.com/mackerelio/go-osstat/disk: build constraints exclude all Go files in /Users/liranb/go/pkg/mod/github.com/mackerelio/[email protected]/disk
the mem/cpu works as expected.
is there a known issue?
I tried to do
go clean -modcache
thanks
Am I able to get CPU Usage of a specific PID?
Is it possible to support collecting each CPU core usage instead of aggregated CPU usage?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.