Coder Social home page Coder Social logo

glinks's Introduction

glinks

Linux Kernel Stats in Go

This tool basically parses and presents all useful data I can find under /proc on Linux.

Fun with math

This originally started with gathering this sort of data via Sensu for Graphite. The Sensu plugins for checking CPU statistics are seriously flawed (eg. sensu-plugins-cpu-checks).

Basically they screw up sampling royally by polling the values, sleeping a second, polling again, and calculating over the 1 second interval. It's a completely accurate measure over that second, but you really want to sample the entire time from the last run.

Whawhat???

OK, so imagine you set the check interval at 10 seconds. Basically you're measuring only the first second out of every ten. Worst case you could have a workload that beats every ten seconds. The check is going to either show the highest workload if the check coincides with the work, or lowest workload if they're out of phase. The further apart the checks are, the less representative your 1 second sample is.

But it's not just this weird workload, any workload that fluctuates will be inaccurately measured and graphed even worse. The fact that it's being graphed assumes that the check needs to cover the duration since the last, not just the next second.

So why not fix their stuff?

So it goes back to the awesome sysstat package. I really just wanted to use the venerable sar and co. But their use is really intended to be interactive. I don't want to push the data from every host, I want to pull it and be able to change intervals on the fly.

So I could rewrite the Sensu plugin and do all this work in Ruby or something. But that just seems so single purpose. Plus I don't want to fire up an interpreter for something that I may need to run at a pretty high frequency.

I'm selfish

I also was just looking for a good excuse to use Go. I'd written toys, but this seemed like a good task for it.

  • I want it to be compiled so I don't have interpreter/JVM overhead
  • I don't want to have to worry about the version of Ruby or Python on the host or that ships with Sensu or whatnot
  • Statically linked is a real plus for easy distribution, no library hell across distros and versions.
  • I don't want to introduce a lot of memory issues with the strings coming from these text files

TODO

  • Support running as a daemon with an REST GET-only interface
  • Should I parse /proc/zoneinfo or anything else?

glinks's People

Contributors

mmessmore avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.