mtop (MySQL top) is an open source real time MYSQL Server monitoring program that shows queries which are taking longer time to process and kills those longer queries after certain number of specified time. Mtop program enable us to monitor and identify performance and related issues of MySQL Server from the command line interface similar to Linux Top Command.
Please check some of the following features offered by Mtop program.
* Display real time MySQL server queries.
* Provides MySQL configuration information.
* Zooming feature to display process query.
* Provides query Optimizer information for a query and ‘killing’ queries.
* Provides MySQL tuning tips.
* Ability to save output in a .mtoprc configuration file.
* Provides Sysadmin recommendation page (‘T‘).
* Added queries/second to main header.
* Added per second info to stats screen.
Install RPMForge on RHEL/CentOS 6First, you need to enable RPMForge repository under your Linux machine to download and install latest version of MTOP program.
For RHEL/CentOS 6 32-Bit OS# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm
For RHEL/CentOS 6 64-Bit OS# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Install Mtop in RHEL/CentOS# yum install mtop
Starting Mtop in RHEL/CentOSTo start Mtop program, you need to connect to your MySQL Server, using following command.
# mysql -u root -p
mysql> grant super, reload, process on *.* to mysqltop;
Query OK, 0 rows affected (0.00 sec)
mysql> grant super, reload, process on *.* to mysqltop@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
Running Mtop in RHEL/CentOS# mtop
load average: 0.01, 0.00, 0.00 mysqld 5.1.61 up 5 day(s), 19:21 hrs
2 threads: 1 running, 0 cached. Queries/slow: 5/0 Cache Hit: 71.43%
Opened tables: 0 RRN: 277 TLW: 0 SFJ: 0 SMP: 0 QPS: 0
ID USER HOST DB TIME COMMAND STATE INFO
322081 mysqltop localhost Query show full processlist
Monitor Remote MySQL Server using Mtop# mtop –host=remotehost –dbuser=username –password=password –seconds=1