Monitor disk availability

The Cloud SQL out-of-disk recommender proactively generates recommendations that help you reduce the risk of downtime that might be caused by your instances running out of disk space. You can apply these recommendations when a Cloud SQL instance is trending toward a storage limit. This page describes how this recommender works and how to use it.

How it works

The Cloud SQL out-of-disk recommender analyzes the storage utilization trend over the last 30 days. When an instance is trending toward a limit where it's likely to run out of space within the next 1 to 30 days, the recommender generates related recommendations to manually increase the storage capacity, set the storage capacity to automatically increase, or free up space.

Pricing

The Cloud SQL idle instance recommender is in the Standard Recommender pricing tier.

Before you begin

Before you can view recommendations and insights, do the following:

  • To get the permissions to view and work with insights and recommendations, ensure that you have the required roles.
    Tasks Roles
    View recommendations One of these roles: recommender.cloudsqlViewer or cloudsql.viewer.
    Apply recommendations One of these roles: recommender.cloudsqlAdmin, cloudsql.editor, or cloudsql.admin.
    For more information about roles, see understanding roles and granting IAM permissions.
  • Enable the Recommender API.

    Enable the API

List out-of-disk recommendations

You can list out-of-disk instance recommendations by using the Cloud Console, gcloud, or the Recommender API.

Out-of-disk recommendations are shown only if you have instances that are nearing disk capacity.

Console

To list out-of-disk recommendations by using the Cloud Console, follow these steps:

  1. Go to the Cloud SQL Instances page.

    Go to Cloud SQL Instances

  2. Click View all on the out-of-disk recommendations banner.

Alternatively, follow these steps:

  1. Go to the Recommendation Hub. See also Getting started with Recommendation Hub.

    Go to the Recommendation Hub

  2. In the Prevent Downtime for SQL instances card, click View all.

gcloud

To list out-of-disk recommendations by using gcloud, run the gcloud recommender recommendations list command as follows:

gcloud recommender recommendations list \
--project=PROJECT_ID \
--location=LOCATION \
--recommender=google.cloudsql.instance.RECOMMENDER

Replace the following:

  • PROJECT_ID: Your project ID
  • LOCATION: A region, such as us-central1
  • RECOMMENDER: The ID of the recommender as OutOfDiskRecommender.

API

To list out-of-disk recommendations by using the Recommendations API, call the recommendations.list method as follows:

GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/recommenders/google.cloudsql.instance.RECOMMENDER/recommendations

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such as us-central1.
  • RECOMMENDER: The ID of the recommender as OutOfDiskRecommender.

View insights and detailed recommendations

You can view insights and detailed recommendations about instances that are nearly out of disk space by using the Cloud Console, gcloud, or the Recommender API.

Console

To view insights and detailed recommendations about instances that are nearly out of disk space by using the Cloud Console, click a recommendation from the list of recommendations.

gcloud

To view insights and detailed recommendations about instances that are nearly out of disk space by using gcloud, run the gcloud recommender insights list command as follows:

gcloud recommender insights list \
--project=PROJECT_ID \
--location=LOCATION \
--insight-type=google.cloudsql.instance.INSIGHT_TYPE

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such as us-central1.
  • INSIGHT_TYPE: The ID of the insight type as DiskUsageTrendInsight.

API

To view insights and detailed recommendations about instances that are nearly out of disk space by using the Recommendations API, call the insights.list method as follows:

GET https://recommender.googleapis.com/v1beta1/projects/PROJECT-ID/locations/LOCATION/insightTypes/google.cloudsql.instance.INSIGHT_TYPE/insights

Replace the following:

  • PROJECT_ID: Your project ID.
  • LOCATION: A region, such as us-central1.
  • INSIGHT_TYPE: The ID of the insight type as DiskUsageTrendInsight.

The following table lists the insight and recommendation that the Cloud SQL out-of-disk recommender generates. The subtypes are visible in the gcloud and API results.

Insight Recommendation
Based on the current storage use trend, the instance is likely to run out of disk space, which can result in downtime.
Subtype: TRENDING_OUT_OF_DISK
Enable auto grow, manually increase storage capacity, or free up disk space.
Subtype: ENABLE_AUTO_STORAGE_INCREASE

Apply recommendations

Evaluate the recommendations carefully and do any of the following:

  • To examine the recommendation, click View instance.

    Edit the instance, if required, to manually increase the storage capacity and set the storage capacity to automatically increase. Alternatively, delete data to free up space.

  • To dismiss the recommendation so that it's de-emphasized and appears dimmed, click Dismiss.

  • To close the panel without applying or dismissing the recommendation, click Cancel.

What's next