Wednesday, November 11, 2009

MySQL monitoring Using ' mycheckpoint '

Download the packge from here .
Dependencies
    yum install MySQL-python.
Installation   
  untar the file and run follwoing commands
          tar xzfv mycheckpoint-XXX.tar.gz
          cd mycheckpoint-XXX
          sudo python setup.py install


Run follwing commads on mysql prompt
     CREATE DATABASE mycheckpoint;   
     GRANT ALL PRIVILEGES ON mycheckpoint.* TO                        
                     'monitoring_user'@'localhost' IDENTIFIED BY '_password';
    GRANT SUPER ON *.* TO 'monitoring_user'@'localhost';
    GRANT REPLICATION CLIENT ON *.* TO 'monitoring_user'@'localhost';


Run following command on command prompt
  
           mycheckpoint --user=monitoring_user --password=_password
           --host=localhost --socket=/tmp/mysql.sock -v --chart-width=500
           --chart-height=300 deploy


Creating defaults-file:

[client]
user=monitoring_user
password=_password
socket=/tmp/mysql.sock
port=3306
host=localhost
Create a file with above contents and save it as /root/.my-checkpoint.cnf
make follwing crontab entry

      */5 * * * *     mycheckpoint --defaults-file=/root/.my-checkpoint.cnf

Detecting parameters change:
   
    SELECT * FROM sv_param_change;
   
Generating Google charts:
    DESC sv_report_chart_sample;

    SELECT DML FROM sv_report_chart_hour \G
     we can create google charts for all the values in sv_report_chart_sample.

Generating HTML reports:

        mysql --user=monitoring_user --password=_password
                   --host=localhost   mycheckpoint 
                    -e "SELECT html FROM sv_report_html" --silent --raw >
                       /tmp/mycheckpoint_report.htm
l

Generating human Readable reports:

Previous hour’s report by:

    SELECT report FROM sv_report_human_hour ORDER BY id DESC LIMIT 1,1 \G

Last week’s report by:

    SELECT report FROM sv_report_human_day WHERE ts = DATE(NOW()) - INTERVAL 7 DAY\G

And all 24 of yesterday’s hourly reports by:

    SELECT report FROM sv_report_human_hour WHERE ts >= DATE(NOW()) - INTERVAL 1 DAY AND ts < DATE(NOW())\G
   
Replication Monitoring:
   
    SELECT seconds_behind_master FROM sv_report_chart_hour\G

Estimating slave catchup time   

    SELECT ts, estimated_slave_catchup_seconds FROM sv_report_hour;

No comments: