MySQL is a relational database management system that runs as a server providing multi-user access to a number of databases. For more information visit mysql.com.
Even if the MySQL plugin is not configured, Monitoring will discover MySQL services running in your Cloud Platform project by:
- Searching instance names for mysql
- Checking for ports opened to 3306 via firewall rules
The services discovered are displayed on the MySQL Services page in the Resources menu. After you install the monitoring agent and the MySQL plugin on your instances, Monitoring populates the MySQL Services page with inventory and metrics.
Configuring MySQL monitoring
The Monitoring agent uses the Connector/C API to monitor MySQL. The Connector/C library is installed by default alongside MySQL on most Linux systems supported by the Monitoring agent except Ubuntu 16.04 LTS.
On Ubuntu 16.04 LTS and Amazon AMI 2016.03 or later, after installing MySQL, you must install missing dependencies by running the following commands:
Ubuntu 16.04 LTS
sudo apt-get install libmysqlclient20
Amazon AMI 2016.03 or later
sudo yum install mysql-libs
Configuring Monitoring to monitor MySQL
After you install the monitoring agent, use the following instructions to configure the MySQL plugin on your instances.
For MySQL collection, you must add a user with a password to MySQL that can run
the SHOW STATUS command. This user and password are referred to as
STATS_PASS in the following config file.
Enabling the MySQL monitoring plugin
MySQL is configured per database on your system. At the moment, no drop-in
configuration is available. The following configuration file shows how to
configure one database, named
You would need to use that configuration as a template for your databases.
(cd /opt/stackdriver/collectd/etc/collectd.d/ && sudo curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/mysql.conf)
As root, edit the downloaded configuration file and add information about
your databases. Inline comments point out where you need to add configuration
for additional databases. Wherever you see
DATABASE_NAME, substitute the name
of your database.
After editing the configuration file, restart the monitoring agent by running the following command:
sudo service stackdriver-agent restart
For more information on the
mysql plugin, see
What is monitored
The full list of metrics the MySQL plugin monitors is at Agent metrics: mysql.