Monitoring 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.

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, a recommendation is generated that suggests one of the following actions:

The following table lists the recommendation and insights that the Cloud SQL out-of-disk recommender can generate.

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

Pricing

This recommender falls under the standard recommender pricing tier that is available at no additional cost. See the recommender pricing page for more details on pricing tiers.

Before you begin

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

Description Roles
View recommendations recommender.cloudsqlViewer
cloudsql.viewer
View and update recommendations recommender.cloudsqlAdmin
cloudsql.editor
cloudsql.admin

These roles provide a set of permissions that enable you to access the insights and recommendations.

For more information about roles, see understanding roles and granting IAM permissions.

Recommender IDs

These are the out-of-disk recommender IDs:

  • google.cloudsql.instance.OutOfDiskRecommender
  • google.cloudsql.instance.DiskUsageTrendInsight

Required IAM permissions

To access the list of Cloud SQL recommendations and insights, the following permissions are required:

  • recommender.cloudsqlInstanceOutOfDiskRecommendations.get
  • recommender.cloudsqlInstanceOutOfDiskRecommendations.list
  • recommender.cloudsqlInstanceOutOfDiskRecommendations.update
  • recommender.cloudsqlInstanceDiskUsageTrendInsights.get
  • recommender.cloudsqlInstanceDiskUsageTrendInsights.list
  • recommender.cloudsqlInstanceDiskUsageTrendInsights.update

For more details on these permissions, see Project Access Control.

Viewing out-of-disk recommendations

This section describes how to check for out of disk insights and recommendations using the Cloud Console, gcloud, and the API.

Console

To view recommendations for an instance by using the Cloud Console, follow the steps below:

  1. In the Cloud Console, go to the Cloud SQL Instances page.

    Go to Cloud SQL Instances

  2. To view recommendations, click VIEW ALL on the banner that displays the number of instances that are at or nearing capacity.

  3. To view details of the recommendation, click the recommendation corresponding to an instance from the list. On the corresponding recommendation page, you can do any of the following:

    • To go to the overview page of the instance, click VIEW INSTANCE.
    • If you do not want to apply the recommendation, click DISMISS.

Alternatively, follow the steps below:

  1. In the Cloud Console, go to the Recommendation Hub.

    Go to the Recommendation Hub

    For more information, see Getting started with Recommendation Hub.

  2. In the Prevent Downtime for SQL instances card, click View all to view the list of recommendations.

  3. Click a recommendation from the list to view the recommendation details for that instance.

  4. Do any of the following:

    • To go to the overview page of the instance, click VIEW INSTANCE.
    • If you do not want to apply the recommendation, click DISMISS.

gcloud

To view recommendations and insights using gcloud, follow the steps below. For more information, see Using the API - Insights and Using the API - Recommendations.

  1. To list the out-of-disk recommendations, run the following command:

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

    Replace the following:

    • PROJECT_ID: your project ID
    • LOCATION: a region, such as us-central1

    When the API call does not return any recommendations, it means that there are neither any out-of-disk conditions approaching overutilization nor any insights.

  2. To list all the trending out-of-disk insights, run the following command:

    gcloud recommender insights list \
    --project=PROJECT_ID \
    --location=LOCATION \
    --recommender=google.cloudsql.instance.DiskUsageTrendInsight
    

    Replace the following:

    • PROJECT_ID: your project ID
    • LOCATION: a region, such as us-central1

API

To view recommendations and insights by using the API, follow the steps below. For more information, see Using the API - Insights and Using the API - Recommendations.

  1. Call the recommendations.list method:

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

    Replace the following:

    • PROJECT_ID: your project ID
    • LOCATION: a region, such as us-central1

    When the API call does not return any recommendations, it means that there are neither any out-of-disk conditions approaching overutilization nor any insights.

  2. Call the insights.list method:

    GET https://recommender.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION/insightTypes/google.cloudsql.instance.DiskUsageTrendInsightinsights
    

    Replace the following:

    • PROJECT_ID: your project ID
    • LOCATION: a region, such as us-central1

What's next