Xaprb

Stay curious!

Poor man’s mytop

with 9 comments

I often need to watch a server that’s very minimally configured, e.g. has no Perl DBI libraries installed, and I shouldn’t install anything. The following snippet is a quick way to do that:

watch 'mysqladmin proc | grep -v Sleep | cut -b0-130'

Replace 130 by the width of your terminal, naturally.

(Of course, innotop is much more featureful than mytop, but mytop is the essential functionality we’re going for here!)

Further Reading:

Written by Xaprb

February 17th, 2011 at 6:41 pm

Posted in Innotop,Perl,SQL

9 Responses to 'Poor man’s mytop'

Subscribe to comments with RSS

  1. Add ‘-n 10′ to refresh watch every 10 seconds or replace it with the interval of your choice.

    Add ‘-d’ to get the differences between runs highlighted.

    I usually use the following line:

    watch -n 10 -d “mysqladmin proc | … “

    The quotes (” or ‘) are needed to enclose the pipe “|”

    My $.02
    G

    Gerry

    17 Feb 11 at 9:03 pm

  2. watch –interval=1 –differences ‘mysql -uroot -pPassWd -e “show slave status\G”‘

    Shantanu Oak

    18 Feb 11 at 2:38 am

  3. My Commandline tells me:
    cut: fields and positions are numbered from 1

    so i better typed cut with range from 1-130:

    watch ‘mysqladmin -u root -p77Gp22TuZ9dC proc | grep -v Sleep | cut -b 1-130′

    But, nice command, anyway, thanks for sharing.

    Exilist

    18 Feb 11 at 5:14 am

  4. I am a honk and going to change my PW now ^^

    Exilist

    18 Feb 11 at 5:16 am

  5. Heh. Clever.

    Jeremy Zawodny

    18 Feb 11 at 1:08 pm

  6. I like one liners and your is useful.

    But MyTop is so much more. If you are using lots of MyISAM it can be better then innotop. I’ve continued to use it and make some improvements.

    http://www.mysqlfanboy.com/mytop/

    Mark Grennan

    18 Feb 11 at 3:51 pm

  7. What does mytop do that innotop can’t do?

    Xaprb

    18 Feb 11 at 4:38 pm

  8. Live forever apparently.

    Jeremy Zawodny

    18 Feb 11 at 10:25 pm

  9. Very true!

    Xaprb

    23 Feb 11 at 3:02 pm

Leave a Reply