简体   繁体   English

我可以使用任何堆栈驱动程序监控 api 或 gcloud 命令获得 gcp 计算建议以调整实例大小吗

[英]Can I get gcp compute recommendations to resize the instance using any stackdriver monitoring api or gcloud command

I want to get the recommendation to resize the instances which gcp shows on there ui for compute instances either through any gcloud command or any api which google provides for stackdriver.我想获得建议,通过任何 gcloud 命令或谷歌为 stackdriver 提供的任何 api 来调整 gcp 在 ui 上显示的计算实例的大小。 (any method would work, just need to get the data of there recommendations they provide of resizing the instances) (任何方法都可以,只需要获取他们提供的调整实例大小的建议的数据)

Google has made this available through its Recommender API (note that it still in beta). Google 已通过其推荐程序 API提供此功能(请注意,它仍处于测试阶段)。

You can interact with it with eitherthe gcloud command-line tool, for example, to list recommendations on Compute Engine instance type:您可以使用 gcloud 命令行工具与之交互,例如,列出有关 Compute Engine 实例类型的建议:

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

or with the REST API.或使用 REST API。 For example:例如:

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"

You can have a look here to get more details info about available actions.您可以查看此处以获取有关可用操作的更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取未在 gcp 中安装 stackdriver 监控代理的实例列表? - How can I get list of instances where stackdriver monitoring agent is not installed in gcp? 如何通过 python 脚本获取 gcp stackdriver 日志? - how can I get gcp stackdriver logs via python script? 相当于Gcloud计算实例组托管列表的API - API equivalent of Gcloud compute instance-groups managed list 使用python对GCP计算API端点进行身份验证 - using python to authenticate to GCP compute API endpoint 使用gcloud python API获取实例映像名称 - Get Instance Images name with the gcloud python api 使用 for 命令从 for 命令获取不同数字作为输入的建议 - Recommendations for using the for command to get different numbers as inputs from for command 我可以使用 GCP VM (xxx-compute@developer.gserviceaccount.com) 的服务帐户而不是 SA json 文件来使用 python 进行 api 调用吗? - Can I use the service account of a GCP VM (xxx-compute@developer.gserviceaccount.com) instead of SA json file to make api calls using python? 使用 Python API 删除 GCP 实例元数据 - Remove GCP instance metadata using Python API 如何在 GCP 中使用 Compute API 列出具有特定标签的实例? - How do list instances with specific label using Compute API in GCP? 将 Tableau 连接到运行 TabPy 的 GCP 计算实例 - Connect Tableau to GCP Compute Instance running TabPy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM