将过滤器应用于 gcloud sql

发布于 2025-01-14 16:30:26 字数 574 浏览 3 评论 0原文

我正在尝试根据 cloudsql 实例是否有使用 gcloud cli 的建议来过滤它们。

例如,我想列出接近存储容量的所有实例。

我尝试了这个,但没有运气:

➜ gcloud sql instances list --project <project-name> --filter='recommendations:on'

➜ gcloud sql instances list --project <project-name> --filter='recommendations:*'
WARNING: The following filter keys were not present in any resource : recommendations
Listed 0 items.

在此处输入图像描述

有什么帮助吗?

I am trying to filter a fleet of cloudsql instances based on if they have a recommendation using gcloud cli.

For example I want to list the all the instances that are nearing storage capacity.

I tried this but no luck:

➜ gcloud sql instances list --project <project-name> --filter='recommendations:on'

➜ gcloud sql instances list --project <project-name> --filter='recommendations:*'
WARNING: The following filter keys were not present in any resource : recommendations
Listed 0 items.

enter image description here

Any help please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

贪了杯 2025-01-21 16:30:26

您可以通过 gcloud CLI 使用推荐器API,直接根据您的需求使用这些推荐实例。在这种情况下,请尝试使用 gcloud 推荐系统推荐列表 命令 并使用任何可用的 Cloud SQL 传递 --recommender=RECOMMENDER 标志href="https://cloud.google.com/recommender/docs/recommenders" rel="nofollow noreferrer">建议(包括磁盘不足):

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

gcloud sql 实例列表 添加更多上下文,即任何给定的可用过滤器可以通过对 YAML 输出进行采样(使用 --format=yaml)来查看 gcloud 命令,如 文档。我尝试过,但推荐数据未作为可用属性返回。

You can use the Recommender API through the gcloud CLI to work directly with these recommendations for your instances. In this case, try using the gcloud recommender recommendations list command and passing the --recommender=RECOMMENDER flag with any of the available Cloud SQL recommendations (including out of disk):

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

Adding more context for gcloud sql instances list, the available filters for any given gcloud command can be seen by sampling the YAML output (using --format=yaml), as noted in the documentation. I tried it, but recommendation data is not returned as an available property.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文