NAME

mtop - Shows top mysql threads

DESCRIPTION

mtop [--host {mysql_host}] [--dbuser {mysql_user}] [--password {mysqluser_pw}] [--seconds {refresh}] [--[no]idle] [--user {user}]

Shows the commands consuming the greatest time. By default, only non-sleeping threads are shown, the --idle option shows idle threads. While running several keys will affect the operation of mtop. Hitting h or ? will show the available options.

The following keys are active while mtop is running:

q       - quit
h or ?  - help
k       - kill processes; send a kill to a list of ids
s       - change the number of seconds to delay between updates
u       - display process for only one user (+ selects all users)
i       - toggle all/non-Sleeping process display
o       - reverse the sort order
e       - explain a process; show query optimizer info
z       - zoom in on a process; show sql statement detail 

OPTIONS

    --host {mysql_host} By default, the mysqld on localhost is monitored. Specify an alternate host with this option.

    --dbuser {mysql_user} By default, the user 'mysqltop' is used to connect to the database. Specify an alternate user with this option.

    --password {mysqluser_pw} By default, there is no password associated with the mysqltop user, specify a password with this option.

    --seconds {refresh} The default screen refresh is 5 seconds.

    --[no]idle By default, processes in the Sleep command state are not shown. This option turns on display of idle threads.

    --user {user} Show only threads owned by this user.

Requires DBD::mysql, Curses, and Net::Domain.

SETUP

The most convenient way to setup your system to use mtop is to create a database user called mysqltop which has no password. For security purposes, this user should have all privileges set to N except Process_priv which must be set to Y.

In addition, the mysqltop user must have Select_priv to the test database. This requirement is only needed becuase the DBI driver requires a database to connect to even though no database commands are issued. The only commands this program issues are non-database specific (SHOW FULL PROCESSLIST, SHOW VARIABLES, KILL id).

AUTHOR

Marc Prewitt, Chelsea Networks <mprewitt@chelsea.net>

TODO

Add flush status

Offer sorts by other columns

For the 'More:' paging, it would be nice to support 'Less' behaviour.

Add 'show status' and 'show variables' output.

Add support for saving commandline opts in ~/.mtop

Add 'n' command and properly calculate number of lines on screen.