Skip to content

tgogos/rpi_cpu_memory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

How to get CPU and Memory usage from a Raspberry Pi

This code was tested on a Raspberry Pi 3 with Raspian Jessie, values were "pushed" to an influxDB and then were visualized with Grafana.

How to run

# first "go get" the goprocinfo library:
go get github.com/c9s/goprocinfo

# then run it with
go run main.go

Where do these stats come from?

goprocinfo uses /proc/stat and /proc/meminfo pseudo-files.

How is the CPU usage calculated by those values?

I follow the approach proposed here: Accurate calculation of CPU usage given in percentage in Linux

What about the Memory?

I follow the approach proposed here (by the htop command author): How to calculate memory usage from /proc/meminfo (like htop)

About

Go code to get CPU and Memory usage from a Raspberry Pi

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages