MySQL plugin Stay organized with collections Save and categorize content based on your preferences.
MySQL is a relational database management system that runs as a serverproviding multi-user access to a number of databases.For more information visitmysql.com.
This functionality is only available for agents running on Linux. It isnot available on Windows.
Note: You can now collect metrics from your MySQL instance using theOps Agent, the primary andpreferred agent for collecting telemetry from your Compute Engine instances.For details, seeconfiguring the Ops Agent forMySQL.Discovery
Even if the MySQL plugin is not configured, Monitoring willdiscover MySQL services running in your Cloud Platform project by:
- Searching instance names formysql
- Checking for ports opened to3306 via firewall rules
To see the metrics for MySQL, do the following:
In the Google Cloud console, go to the
Dashboards page:If you use the search bar to find this page, then select the result whose subheading isMonitoring.
- Select theMySQL dashboard from the list.
Configuring MySQL monitoring
The Monitoring agent uses theConnector/C API to monitor MySQL. For Linux distributions that don't include the Connector/Clibrary with MySQL, run the appropriate command to install it:
Ubuntu 16.04 LTS and Ubuntu 18.04 LTS
sudoapt-getinstalllibmysqlclient20Ubuntu 19.10
sudoapt-getinstalllibmysqlclient21Debian 9
sudoapt-getinstalllibmariadbclient18Amazon AMI 2016.03 or later
sudoyuminstallmysql-libsSLES 12
sudozypperinstalllibmysqlclient18SLES 15
sudozypperinstalllibmariadb3Configuring Monitoring to monitor MySQL
After youinstall the monitoring agent, usethe 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 runtheSHOW STATUS command. This user and password are referred to asSTATS_USER andSTATS_PASS in the following config file.
Enabling the MySQL monitoring plugin
MySQL is configured per database on your system. At the moment, no drop-inconfiguration is available. The following configuration file shows how toconfigure one database, namedDATABASE_NAME.You would need to use that configuration as a template for your databases.
On your VM instance, downloadmysql.conf from theGitHub configuration repository and place it in the directory/etc/stackdriver/collectd.d/:
(cd/etc/stackdriver/collectd.d/ &&sudocurl-Ohttps://raw.githubusercontent.com/Stackdriver/stackdriver-agent-service-configs/master/etc/collectd.d/mysql.conf)Asroot, edit the downloaded configuration file and add information aboutyour databases. Inline comments point out where you need to add configurationfor additional databases. Wherever you seeDATABASE_NAME, substitute the nameof your database.
After editing the configuration file, restart the monitoring agent by running the following command:
sudoservicestackdriver-agentrestartFor more information on thecollectdmysql plugin, seePlugin:MySQL.
What is monitored
The full list of metrics the MySQL plugin monitors is atAgent metrics: mysql.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.