【问题标题】:Can I get gcp compute recommendations to resize the instance using any stackdriver monitoring api or gcloud command我可以使用任何堆栈驱动程序监控 api 或 gcloud 命令获得 gcp 计算建议以调整实例大小吗
【发布时间】:2023-11-27 17:22:01
【问题描述】:

我想通过任何 gcloud 命令或谷歌为 stackdriver 提供的任何 api 获得调整 gcp 在计算实例上显示的实例大小的建议。 (任何方法都可以,只需要获取他们提供的调整实例大小的建议的数据)

【问题讨论】:

    标签: python google-cloud-platform google-compute-engine gcloud libcloud


    【解决方案1】:

    Google 已通过其Recommender API 提供此功能(请注意,它仍处于测试阶段)。

    您可以使用 gcloud 命令行工具与之交互,例如,列出有关 Compute Engine 实例类型的建议:

    gcloud beta recommender recommendations list \
        --project=example-project \
        --location=us-central1-a \
        --recommender=google.compute.instance.MachineTypeRecommender \
        --format=json
    

    或使用 REST API。例如:

    curl \
        -H "Authorization: Bearer $(gcloud auth print-access-token)"  \
        -H "x-goog-user-project: example-project" \
        "https://recommender.googleapis.com/v1beta1/projects/example-project/locations/us-central1-a/recommenders/google.compute.instance.MachineTypeRecommender/recommendations"
    

    您可以查看here 以获取有关可用操作的更多详细信息。

    【讨论】:

      最近更新 更多