Agent MySQL status configuration

The agent can query your MySQL instance to return the following stats:

1. Dependancies

The agent uses the MySQLdb module to interact with MySQL. You must have this installed to use the MySQL monitoring functionality.

Check if you have MySQLdb already

From the command line, enter the Python CLI by running

python

Once the shell appears, enter:

import MySQLdb

When you hit return, if the command completes and you get no errors then you have the module already installed and can skip to step 2 below. If you get ImportError: No module named MySQLdb then follow the instructions below.

Installation - package managed

On package managed systems, you can simply execute on Red Hat compatible systems (CentOS, Fedora, RHEL):

yum install python-devel
yum install MySQL-python

or on other systems (Debian, Ubuntu)

apt-get install python-dev
apt-get install python-mysqldb

Installation - manual

You will need to download MySQLdb and manually install the module. This will require the Python build tools (python-devel) and MySQL development headers (mysql-devel).

Once downloaded and extracted MySQLdb you can install using:

python setup.py build
setup.py install

Note: You may also need the Python setuptools if you get an error trying to run the above commands.

2. Agent configuration

The agent config.cfg file requires 3 additional config lines to be completed to allow the agent to connect to your MySQL server. If you are upgrading from an older agent version and these lines do not exist, you can copy/paste them in anywhere in the file.

mysql_server:
mysql_user:
mysql_pass:

Fill out the details for each line for a MySQL user. Your mysql_server will generally be localhost unless you want the agent to connect to a remote server.

mysql_server: localhost
mysql_user: myMysqlUsername
mysql_pass: myMysqlPassword

Users

You can use any user to connect to the database, although we recommend you create a specific user with no privileges (except for connect). See the MySQL documentation for user management instructions.

Database privileges

No specific database privileges are required for your MySQL user with the exception of the Seconds_Behind_Master stat i.e. in most cases you do not need to do anything else. If you are running MySQL in replication and want to track this stat on your slave, the MySQL user the agent uses must have SUPER or REPLICATION CLIENT privileges.

3. Restart agent

Restart the agent to start the monitoring

python agent.py restart

It will take up to 3 minutes for data to begin to be reported from MySQL.