GCP Cloud MySQL
You can enable this integration using the Connect a GCP Account option on the Monitor UI.
This integration has 33 metrics.
List of Alerts
Alert | Description | Format |
---|---|---|
[GCP Cloud MySQL] Database Down | The MySQL database is down. | Prometheus |
[GCP Cloud MySQL] No High Availability | The MySQL database doesn’t have ‘High Availability’ enabled, or there are no available instances in other zones for automatic failover. The service will be down when the instance undergoes maintenance or has any other issues. | Prometheus |
[GCP Cloud MySQL] High CPU Usage | The CPU usage is reaching the limit. | Prometheus |
[GCP Cloud MySQL] High Memory Usage | The memory usage is reaching the limit. | Prometheus |
[GCP Cloud MySQL] Disk Full in 48h | The disk will be full in 48 hours. | Prometheus |
[GCP Cloud MySQL] Disk Full in 12h | The disk will be full in 12 hours. | Prometheus |
[GCP Cloud MySQL] Replica Lag | The MySQL replica is lagging behind its primary instance. This issue is only applicable to replicas. | Prometheus |
[GCP Cloud MySQL] Network Lag | The time taken from primary binary log to IO thread on replica is high. This issue is only applicable to replicas. | Prometheus |
[GCP Cloud MySQL] Slave SQL Thread Not Running | The MySQL Slave SQL thread is not running. This is only applicable to replicas. | Prometheus |
[GCP Cloud MySQL] Slave IO Thread Not Running | The MySQL Slave IO thread is not running. This issue is only applicable to replicas. | Prometheus |
[GCP Cloud MySQL] High Buffer Pool Dirty Pages Ratio | The buffer pool dirty pages ratio is high. | Prometheus |
List of Dashboards
GCP Cloud MySQL
The dashboard provides information on the GCP Cloud MySQL integration.
List of Metrics
Metric name |
---|
gcp_cloudsql_database_database_auto_failover_request_count |
gcp_cloudsql_database_database_available_for_failover |
gcp_cloudsql_database_database_cpu_utilization |
gcp_cloudsql_database_database_disk_bytes_used_by_data_type |
gcp_cloudsql_database_database_disk_read_ops_count |
gcp_cloudsql_database_database_disk_utilization |
gcp_cloudsql_database_database_disk_write_ops_count |
gcp_cloudsql_database_database_instance_state |
gcp_cloudsql_database_database_memory_utilization |
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_dirty |
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_free |
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_total |
gcp_cloudsql_database_database_mysql_innodb_data_fsyncs |
gcp_cloudsql_database_database_mysql_innodb_os_log_fsyncs |
gcp_cloudsql_database_database_mysql_innodb_pages_read |
gcp_cloudsql_database_database_mysql_innodb_pages_written |
gcp_cloudsql_database_database_mysql_queries |
gcp_cloudsql_database_database_mysql_questions |
gcp_cloudsql_database_database_mysql_received_bytes_count |
gcp_cloudsql_database_database_mysql_replication_last_io_errno |
gcp_cloudsql_database_database_mysql_replication_last_sql_errno |
gcp_cloudsql_database_database_mysql_replication_seconds_behind_master |
gcp_cloudsql_database_database_mysql_replication_slave_io_running_state |
gcp_cloudsql_database_database_mysql_replication_slave_sql_running_state |
gcp_cloudsql_database_database_mysql_sent_bytes_count |
gcp_cloudsql_database_database_network_connections |
gcp_cloudsql_database_database_network_received_bytes_count |
gcp_cloudsql_database_database_network_sent_bytes_count |
gcp_cloudsql_database_database_replication_network_lag |
gcp_cloudsql_database_database_replication_replica_lag |
gcp_cloudsql_database_database_replication_state |
gcp_cloudsql_database_database_up |
gcp_cloudsql_database_database_uptime |
Monitoring and Troubleshooting GCP Cloud MySQL
This document describes important metrics and queries that you can use to monitor and troubleshoot GCP Cloud MySQL.
Most of the metrics covered in this document are applicable to all the GCP Cloud SQL integrations (MySQL, PostgreSQL, SQL Server). There is a separate section for MySQL metrics.
The GCP metrics of type DELTA
, which typically have the suffix _count
in their name (but not always), return the cumulative value of 1 minute. They need to be divided by 60 to get the value per second.
Status and Replication
Status
Use the following query to get the status of the database. A value of 1 means UP, and a value of 0 means DOWN.
gcp_cloudsql_database_database_up
Use the following query to get the current serving state of the Cloud SQL instance. The state is stored inside the label state
.
gcp_cloudsql_database_database_instance_state > 0
The state can be one of the following:
- RUNNING: The instance is expected to be running. If an instance experiences unplanned (non-maintenance) downtime, the state will still be RUNNING, but the
Database UP
metric will report 0. - SUSPENDED: The instance is not available, for example, due to problems with billing.
- RUNNABLE: The instance has been stopped by the owner. It is not currently running but is ready to be restarted.
- PENDING_CREATE: The instance is being created.
- MAINTENANCE: The instance is down for maintenance.
- FAILED: The instance creation failed.
- UNKNOWN_STATE: The state of the instance is unknown.
Replication
Failover
The following query returns a value > 0 if the failover operation is available on the instance.
gcp_cloudsql_database_database_available_for_failover
Use the following query to get the number of instance auto-failover requests per second.
gcp_cloudsql_database_database_auto_failover_request_count / 60
State
Use the following query to get the current serving state of replication. The state is stored inside the label state
. According to the GCP documentation, this metric is in the BETA launch stage.
gcp_cloudsql_database_database_replication_state > 0
The state can be one of the following:
- RUNNING: Replication is active and running.
- STOPPED: Replication is inactive and stopped.
- ERROR: An error has occurred and replication is stopped.
- SYNCING: The replication is syncing.
- UNSYNCED: The replication is unsynced.
Replica and Network Lag
Use the following query to get the approximate number of seconds the read replica is behind its primary instance. This is only applicable to replicas.
gcp_cloudsql_database_database_replication_replica_lag
The following query indicates time taken from primary binary log to IO thread on replica. This is only applicable to replicas.
gcp_cloudsql_database_database_replication_network_lag
CPU, Memory and Storage
CPU
Use the following query to get the current CPU utilization represented as a percentage of the reserved CPU that is currently in use. The return values are typically numbers between 0 and 1 (but might exceed 1).
gcp_cloudsql_database_database_cpu_utilization
Memory
Use the following query to get the percentage of the memory quota that is currently in use. The return values are numbers between 0 and 1.
gcp_cloudsql_database_database_memory_utilization
Disk
Use the following query to get the percentage of the disk quota that is currently in use. The return values are numbers between 0 and 1.
gcp_cloudsql_database_database_disk_utilization
Use the following query to get the disk usage per data type. The data type is stored inside the label data_type
. According to the GCP documentation, this metric is in the BETA launch stage.
gcp_cloudsql_database_database_disk_bytes_used_by_data_type
Use the following queries to get the disk read and write IO operations per second.
gcp_cloudsql_database_database_disk_read_ops_count / 60
gcp_cloudsql_database_database_disk_write_ops_count / 60
Network
Use the following query to get the number of connections to databases on the Cloud SQL instance. This is only applicable to MySQL and SQL Servers.
gcp_cloudsql_database_database_network_connections
Use the following queries to get the bytes received and sent through the network per second.
gcp_cloudsql_database_database_network_received_bytes_count / 60
gcp_cloudsql_database_database_network_sent_bytes_count / 60
MySQL Stats
InnoDB
Pages
Use the following query to get the number of InnoDB pages read per second.
gcp_cloudsql_database_database_mysql_innodb_pages_read / 60
Use the following query to get the number of InnoDB pages written per second.
gcp_cloudsql_database_database_mysql_innodb_pages_written / 60
Fsync() Calls
Use the following query to get the number of InnoDB fsync() calls per second.
gcp_cloudsql_database_database_mysql_innodb_data_fsyncs / 60
Use the following query to get the number of InnoDB fsync() calls to the log file per second.
gcp_cloudsql_database_database_mysql_innodb_os_log_fsyncs / 60
Buffer Pool Pages
Use the following query to get the number of unflushed pages in the InnoDB buffer pool.
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_dirty
Use the following query to get the number of unused pages in the InnoDB buffer pool.
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_free
Using the metric for the total number of pages, you can calculate the buffer pool dirty pages ratio.
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_dirty
/
gcp_cloudsql_database_database_mysql_innodb_buffer_pool_pages_total
Queries and Network
Use the following query to get the number of statements executed by the server sent by the client per second.
gcp_cloudsql_database_database_mysql_questions / 60
Use the following query to get the number of statements executed by the server per second.
gcp_cloudsql_database_database_mysql_queries / 60
Use the following queries to get the bytes received and sent by MySQL process per second.
gcp_cloudsql_database_database_mysql_received_bytes_count / 60
gcp_cloudsql_database_database_mysql_sent_bytes_count / 60
Replication
Lag
Use the following query to get the approximate number of seconds the read replica is lagging behind its primary instance.
gcp_cloudsql_database_database_mysql_replication_seconds_behind_master
Threads State
The following query returns a value that indicates whether the SQL thread for executing events in the relay log is running. The possible values inside the state
label are Yes
and No
.
gcp_cloudsql_database_database_mysql_replication_slave_sql_running_state > 0
The following query returns a value that indicates whether the I/O thread for reading the primary binary log is running. The possible values inside the state
label are Yes
, No
and Connecting
.
gcp_cloudsql_database_database_mysql_replication_slave_io_running_state > 0
Error Numbers
Use the following query to get the error number of the most recent error that caused the SQL thread to stop.
gcp_cloudsql_database_database_mysql_replication_last_sql_errno
Use the following query to get the error number of the most recent error that caused the I/O thread to stop.
gcp_cloudsql_database_database_mysql_replication_last_io_errno
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.