MySQL Plugin

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.

Discovery

Even if the MySQL plugin is not configured, Stackdriver 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, Stackdriver Monitoring populates the MySQL Services page with inventory and metrics.

Configuring Stackdriver Monitoring to monitor MySQL

After you install the monitoring agent, use the following instructions to configure the MySQL plugin on your instances.

Prerequisites

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_USER and 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 DATABASE_NAME. You would need to use that configuration as a template for your databases.

On your VM instance, download mysql.conf from the GitHub configuration repository and place it in the directory /opt/stackdriver/collectd/etc/collectd.d/:

(cd /opt/stackdriver/collectd/etc/collectd.d/ && curl -O https://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/mysql.conf)

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

Information on other plugin configuration options can be found at collectd.org.

What is monitored

The MySQL plugin monitors the following metrics:

  • Connections (count): The number of active connections to MySQL.
  • Select Queries (count): The number of select queries being run.
  • Insert Queries (count): The number of insert queries being run.
  • Update Queries (count): The number of update queries being run.
  • Slave replication lag

Send feedback about...

Stackdriver Monitoring