Coder Social home page Coder Social logo

mysampler's Introduction

MySampler

What is it?

MySampler is a tool written in ruby to poll SHOW GLOBAL STATUS in MySQL and output the values to either a CSV or graphite/carbon. The interval at which the polling occurs can be specified and the output can be either the absolute or relative values, so you can see change over time. If logging to CSV, the a date stamp is appended to the CSV file and it is rotated hourly (to be configurable later).

Dependencies

MySampler requires the following gems:

graphite sequel

Installation

To install, simply install the dependencies above, and clone the repository and run mysample.rb

gem install sequel
gem install graphite
git clone https://github.com/9minutesnooze/mysampler.git
cd mysampler
./mysample.rb -o csv -u me -p secret -H localhost -f /tmp/mysample.csv -i 10 -r -d -k start

Options

Usage ./mysample.rb [OPTIONS]
-u, --user USER                  MySQL User
-p, --pass PASSWORD              MySQL Password
-P, --port PORT                  MySQL port (default 3306)
    --pidfile PIDFILE            PID File (default: `pwd`/mysample.pid)
-H, --host HOST                  MySQL hostname (default: localhost)
-f, --file FILENAME              output filename (will be appended with rotation timestamp)
-o, --output (csv|graphite)      Output format (default: csv)
-i, --sleep SECONDS              Interval between runs (default: 10)
-r, --relative                   Show the difference between the current and previous values (default: false)
-d, --daemonize                  daemonize process (default: false)
-k (start|stop|status)           command to pass daemon
    --command
-g, --graphite HOST:PORT         Graphite server:port
-h, --help                       this message

If daemonized with -d, currently STDERR/STDOUT does not go anywhere, so if you are having problems, try running it without the -d flag initially.

Caveats

This project, while it runs in production, is rapidly changing so the command line parameters and output are not set in stone.
I will attempt to write release notes if something changes drastically. Currently a lot of the object structure is being revamped and I am adding more features such as SHOW MUTEX STATUS, and SHOW ENGINE INNODB STATUS.
Those features are initially available in the class_refactor branch.

mysampler's People

Contributors

aaronbbrown avatar teancom avatar

Stargazers

GAURAV avatar Deepak Barge avatar Angus H. avatar Chao Nie avatar Adrian Likins avatar Joel avatar Vlada Petrović avatar  avatar Dana Cleveland avatar Sergio Rodriguez avatar  avatar  avatar  avatar John E. Vincent avatar Mark Devlin avatar Sergio Rubio avatar Joshua Warchol avatar

Watchers

Jon Gaudette avatar Chao Nie avatar James Cloos avatar  avatar  avatar

Forkers

teancom bodsch

mysampler's Issues

How to capture mysql replication status?

Hi there,

We've found some pre-existing mysql monitoring configurations using mysampler. Unfortunately, no present folks on our team are very knowledgable in its usage.

So I thought I'd ask here: how might we augment what it is currently sampling to add replication stats?

I see the following info on mysql commands we would issue:
http://dev.mysql.com/doc/refman/5.1/en/replication-administration-status.html
http://blog.webyog.com/2012/11/20/how-to-monitor-mysql-replication/

Hoping there is an easy way to get this additional information via mysampler?

Thanks,
-Marc

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.