Giter Site home page Giter Site logo

pipe-to-graphite's Introduction

pipe-to-graphite

Makes it easy to monitor and report just about anything to Graphite from the commandline.

Why

Created initially to report the useful numbers from service memcached status to Graphite. More examples are added as needed.

How

Write a script that outputs some name value pairs tha your care about. pipe-to-graphite will take care of formatting them and sending them to graphite at regular intervals. The expected output is something like this:

some.thing.count 53453
SomeOtherThing 3522

NOTE: Your script must finish with an exit code of 0 or the output won't be sent to graphite (though it will be logged along with a failure message).

$ > git clone git://github.com/iFixit/pipe-to-graphite.git
$ > cd pipe-to-graphite
$ > ./pipe-to-graphite.sh scripts/memcache-stats.sh
Running 'scripts/memcache-stats.sh' as a test.. SUCCESS

Redirecting stdout to /dev/null so it doesn't mess up your
terminal.  Redirect it somewhere else if you wan't to save it.

Command: scripts/memcache-stats.sh
is being piped to graphite every 10 seconds
Background PID: 18637
$ >

Example

Lets say you want to monitor the glorkd program. Let's say glorkd comes with a script /usr/glork/status that spits out something like this:

Glorkd - v2.1.352
Running: pid 3242
Blargs: 1230
Blorks: 452

You only care about the Blargs and Blorks (those are counts since program start). All you have to do is write a script that does some grepping and awking to get that into this:

Blargs 1230
Blorks 452

Your script (lets say ~/glork-stats.sh) would look something like this:

/usr/glork/status | tail -n +3 | sed "s/: / /"

To get that regularly reported to Graphite, run this command

./pipe-to-graphite.sh ~/glork-stats.sh >> /var/log/glork-stats.log

Or to report it to graphite at any time, if you want to use cron or something. The '-' argument indicates input should be read form stdin

~/glork-stats.sh | ./pipe-to-graphite.sh -

Logging

Output from each run is prepended with a timestamp and echoed to stdout Redirect that wherever you like.

pipe-to-graphite's People

Contributors

danielbeardsley avatar xiongchiamiov avatar sejeff avatar marcusdb avatar

Watchers

James Cloos 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.