• Stars
    star
    455
  • Rank 96,175 (Top 2 %)
  • Language
    Go
  • License
    MIT License
  • Created over 9 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Access OS metrics from Golang,

wercker status

StatGo

StatGo give you access to OS metrics like network interface bandwith, cpus usage ...
It supports FreeBSD, Linux, OSX & more, it's in fact a libstatgrab binding for Golang.
Tested on FreeBSD, OSX, Linux amd64, Linux arm.

Compilation

You need at least libstatgrab 0.91, Debian & Ubuntu only have 0.90 ...

On Debian/Ubunt & OSX, you can simply install libstatgrab with the usual commands:

./configure --prefix=/usr/local
make
sudo make install

You may have to set CGO_LDFLAGS and CGO_CFLAGS environment according to your path:

export CGO_CFLAGS=-I/usr/local/include
export CGO_LDFLAGS=-L/usr/local/lib

Note: On OSX you need to install gcc to access cgo.

go get github.com/akhenakh/statgo

Usage

s := NewStat()
s.HostInfos()
OSName: Darwin
OSRelease:  14.4.0
OSVersion:  Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64
Platform:   x86_64
HostName:   kamoulox
NCPUs:      4
MaxCPUs:    4
BitWidth:   64

s.CPUStats()
User:       7.500000
Kernel:     2.500000
Idle:       90.000000
IOWait      0.000000
Swap:       0.000000
Nice:       0.000000
LoadMin1:   2.206055
LoadMin5:   2.031250
LoadMin15:  1.970703

s.FSInfos()[0]
DeviceName:         /dev/disk1
FSType:             hfs
MountPoint:         /
Size:               249769230336
Used:               224367140864
Free:               25402089472
Available:          25139945472
TotalInodes:        60978814
UsedInodes:         54841132
FreeInodes:         6137682
AvailableInodes:    6137682

s.InterfaceInfos()[0]
Name:   en2
Speed:  0
Factor: 1000000
Duplex: Full Duplex
State:  UP

s.MemStats()
Total:      16649420800
Free:       4323848192
Used:       12325572608
Cache:      0
SwapTotal:  3221225472
SwapUsed:   2528378880
SwapFree:   692846592

s.NetIOStats()
IntName:    en0
TX:         2310272606
RX:         3336240203
IPackets:   114473581
OPackets:   129430304
IErrors:    0
OErrors:    0
Collisions: 0

s.ProcessStats()
Total:      343
Running:    335
Sleeping:   0
Stopped:    0
Zombie:     8

s.PagesStats()
PageIn:     90173695
PageOut:    90173695

Status

  • Host infos
  • cpu stats
  • load average
  • network interfaces infos
  • mem stats
  • swap stat
  • io stats
  • net io stats
  • process count
  • page stats

Contributors

More Repositories

1

mocs

My Own Car System, a Go & Qt application for your car
JavaScript
234
star
2

gozim

A Go native implementation for ZIM files
Go
202
star
3

regionagogo

A worldwide regions or fences database, give it coordinates it answers back with informations for the fence like country and state
Go
76
star
4

kvtiles

Self hosted maps, PMTiles, MBTiles key value storage and server
Go
69
star
5

gpsd

A gps daemon with a gRPC API, can also map match against a local OSRM
Go
40
star
6

mbmatch

An MBTiles server for PBF, which is also a map matcher.
Go
38
star
7

ws2

An S2 coverer map written in Go with Wasm
JavaScript
26
star
8

geottn

A server for The Things Network to store and display your devices on a map
Go
21
star
9

CompareGeoHashvsS2

Tools to compare Geohash and S2 efficiency
Python
17
star
10

nanoAPRS

A 1200 bauds modem based on an Arduino Nano mainly for APRS amateur radio
14
star
11

tsd

A time series + geographical coordinates compression
Go
13
star
12

oureadb

A general purpose geo indexing tool.
Go
11
star
13

martini-influxdb

Martini logger to influxDB
Go
11
star
14

dico

A "database-agnostic modeling system"
Python
10
star
15

testgomobileios

An iOS application that uses a golang mobile framework
Objective-C
10
star
16

hunspellgo

Hunspell bidings for Golang
Go
8
star
17

goth

Go OAuth 1.0a 2 legs provider
Go
7
star
18

sataas

Satellites As A Service
Go
7
star
19

insidetree

A tree datastructure to store s2 cells and perform fast point in polygons lookup
Go
6
star
20

tgo

Go bindings for TG Fast point-in-polygon Geometry
C
6
star
21

gojpegoptim

An in memory jpegoptim chain toolkit for Go.
C
6
star
22

acurite_to_graph

Import Acurite sensor devices to influx or prometheus
Go
6
star
23

insideout

self contained GIS tooling for Point in Polygon tests
Go
6
star
24

httpie-oauth-dm

Dailymotion OAuth2 plugins for httpie
Python
5
star
25

hamaprs

HamAPRS is a Go library to parse and decode APRS packet, mainly based on libfap but provides additional features
Go
5
star
26

geo-benthos

Benthos plugins to transform geographic coordinates from a stream.
Go
4
star
27

bloggae

The engine running kdl.nobugware.com, a dead simple blog using webapp2, Jinja2 on GAE
Python
4
star
28

RocketIO

Interface to communicate between Objective C and Socket.IO
Objective-C
4
star
29

minigit

a minimalist git clone (clone and pull) in pure go
Go
4
star
30

regionagogogen

An OSX cli geo database generator for regionagogo
C++
4
star
31

satsattransponder

Transponders files for SatSat ios app
Python
4
star
32

goh3

A native Go h3 port
Go
4
star
33

NBOAuth1SessionManager

An OAUTH 1.0a session manager for AFNetworking 2
Objective-C
3
star
34

drone-waiton

A drone plugin to wait on services availability
Dockerfile
3
star
35

gurl

HTTP client for CLI
Go
3
star
36

cayenne

Go Cayenne encoding and decoding
Go
2
star
37

logserv

Expose log files via HTTP in a minute safely
Go
2
star
38

h3-bench

Repo to bench different implementation of go h3
Go
2
star
39

rp

a toy reverse proxy for learning purpose
Go
2
star
40

NBGCommon

Useful debug tools for ios development
Objective-C
2
star
41

ft8173dprint

ft-817 stand front
2
star
42

influxhandler

A generic net/http Go InfluxDB handler
Go
2
star
43

wisprgo

WisprGo contains a set of tools to provide a wifi AP with Wispr functionalities.
Go
2
star
44

safepassage

A Drone plugin to safely extract secrets
Go
2
star
45

gshotAlfred

An Alfred 2 workflow to take screenshot and upload to your google drive
1
star
46

ocgrpc_propagation

ocgrpc opencensus gRPC tools with propagation from Jaeger
Go
1
star
47

docindex

An indexer for mkdocs documentation
Go
1
star
48

xpmetrics

Library to read X-Plane metrics sent over UDP in Go language
Go
1
star
49

ml-image-tile

A tool to split images in tiles in preparation for machine learning work
Go
1
star
50

coord2country

A simple solution to query for point in polygon in countries
Go
1
star
51

waiton

A simple command to wait for some hosts to be ready
Go
1
star
52

popgroup

ephemeral discussion and file exchange endpoint
1
star
53

gosgp4

Simplified perturbations models for Go
Go
1
star
54

selfhostmap

A complete solution to self host maps
HTML
1
star