This page describes how to monitor a Cloud SQL instance.
Cloud SQL offers two ways to monitor an instance:
- In the Google Cloud Console
- In Cloud Monitoring
Cloud SQL instance monitoring in the console
Cloud SQL provides some performance monitoring in the instance overview page. A drop-down menu in the chart on that page offers the following options:
- CPU utilization
- Storage usage
- Memory usage
- Read/write operations
- Active connections
- Ingress/Egress bytes
Additionally, a read replica offers the option
- Go to the Cloud SQL Instances page in the Google Cloud Console.
- Click the instance to open its Instance overview page.
The metrics chart is prominent on the top of the page.
GCP Monitoring includes a default Cloud SQL monitoring dashboard, which includes the most commonly used metrics for all of the database instances. You can use this dashboard to monitor the general health of your primary and replica instances.
GCP Monitoring also includes many other metrics on its metrics explorer page:
- In the Google Cloud Console, go to Monitoring or use the following button:
Go to Monitoring
- In the Monitoring navigation pane, click Metrics Explorer.
- Enter the monitored resource name in the Find resource type and metric text box.
To view the metrics for a monitored resource using Metrics Explorer, do the following:
For Resource Type select Cloud SQL Database.
Cloud SQL exports the replication lag metrics, as
reported by the databases, as
The replication lag is the number of bytes that the replica is lagging behind the master instance. This includes writes for which the replica has already received the log, but has not yet applied the log to the database.
In addition to the default Cloud SQL dashboard, you can create a custom dashboard to monitor the replication lag for both in-region and cross-region replicas:
- Go to the Monitoring page.
- Select the Dashboards tab.
- Click + CREATE DASHBOARD on the button bar in the top of the page.
- Give the dashboard a name and click OK
- Click ADD CHARTin the upper right-hand corner of the page.
- For Resource Type select Cloud SQL Database
- In the Select a metric field, type
You can also create an alert for when the metric exceeds a given value. See detailed information on how to use GCP Monitoring.