Xaprb

Stay curious!

Formatting mysqladmin extended-status nicely

with 3 comments

I always say that the ultimate MySQL tuning script is an expert human. To that end, I generally try to build tools that help a human be more productive with the raw information from MySQL. One of the things we look at during a performance audit is the MySQL status counters. It’s useful to look at a) absolute values and b) several incremental snapshots. I’ve written a small shell script called “mext” that can make this a little easier.

It looks like this:

baron@kanga:~$ mext -- mysqladmin ext -ri1 -c3
Aborted_clients                               1      0      0
Aborted_connects                              0      0      0
Binlog_cache_disk_use                         0      0      0
Binlog_cache_use                              0      0      0
Bytes_received                             1167     35     35
Bytes_sent                                38926   6337   6337
....

This isn’t an original idea. Ryan Lowe made a Perl version of this first. I used his version for a while, but after working on a few machines that didn’t have the necessary Perl libraries (maybe one of them didn’t even have Perl, I forget) I decided to do it in shell.

There’s an added feature. It’ll do incremental/differential/relative output for you. The mysqladmin that ships with MySQL 5.1 has a bug that stops it from iterating with -r. So the script I wrote can accept a -r option, which can then be left off the arguments to mysqladmin:

baron@kanga:~$ mext -r -- mysqladmin ext -i1 -c3

It’s kind of a generic tool that you could use with other things besides mysqladmin, but it’s also kind of tweaked for that purpose. You can get mext here.

Further Reading:

Written by Xaprb

April 11th, 2009 at 11:41 am

Posted in Coding,SQL,Tools

Tagged with , ,

3 Responses to 'Formatting mysqladmin extended-status nicely'

Subscribe to comments with RSS

  1. [...] tweaked the mext script so it auto-detects the necessary column widths for each sample. Get mext [...]

  2. [...] wrote a while ago about how mext works — it runs “mysqladmin extended-status” and formats it nicely. But what if [...]

  3. Just found this tool – very cool, and as usual, a very useful script. Thanks

    Kathy Mazur Worden

    12 Jul 10 at 5:31 pm

Leave a Reply