Friday 20 January 2012

How to Monitor Mysql DB in linux


We can monitor mysql queries and database using an utility called MonYog. MONyog is a monitoring and advisory tool for MySQL Community as well as Enterprise versions.MONyog is agent-less, and does not require anything to be installed on the MySQL servers. MONyog helps monitor enterprise database environments.

MONyog MySQL Monitor and Advisor MySQL DBAs manage more MySQL servers,and tune their MySQL servers.

To install monyog get the rpm / tar.gz package

# rpm -ivh monyog.version.rpm
# service monyog start / stop

or

# tar -xvf monyog.version.tar.gz
# cd monyog
# cd bin
# ./MoNyog start / stop

After installing, MONyog will be started automatically as a daemon/service. We can immediately start monitoring your MySQL servers by pointing your browser to:

http://<YOUR_HOST>:5555

After getting the GUI interface perform some more steps to get the desired data's  into the interface.
You have to set the username and password for the interface.
Name for the new Host that need to add the interface.
Mysql host, mysql host username and password.
Mysql connection interval
Enable query logs, error logs

Just go through the following screen shoots for more details
http://www.webyog.com/en/screenshots.php

To Enable mysql query logs you need to add some lines to your my.cnf file and restart.

To enable slow Query Log only
log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 1

To enable full Log Query
log=/var/log/mysqldquery.log

The above will log all queries to the log file.
Don’t forgot to restart mysql service after making changes in my.cnf file.



No comments:

Post a Comment