英文:
How to know whether an instance is scaled up or down in GCP
问题
如何在给定的时间段内(比如上个月)以编程方式知道计算实例(可以是在任何组中,如集群、MIG等)是否在扩展或缩小?
假设托管实例组中的每个实例的VCPU都增加了2个VCPU,如何以编程方式知道这一点?
英文:
How to know whether a compute instance (it can be in a group of anything, clusters, MIG etc...) is scaled up or down in a given time period(lets say last month) programmatically?
Lets say that every instance in an managed instance group got an increase in VCPU by 2VCPUS, how to know this programmatically?
答案1
得分: 2
Managed Instance Groups(MIG)主要用于横向扩展。
您可以使用 instanceGroupManagers().listManagedInstances 方法来检索MIG中实例的列表,并使用 instanceGroupManagers.aggregatedList 来返回实例的当前状态。
然而,您仍然需要定期调用API并自行存储历史数据。
英文:
Managed Instance Groups are primarily designed for horizontal scaling.
You could use the instanceGroupManagers().listManagedInstances method to retrieve the list of instances in the MIG and use the instanceGroupManagers.aggregatedList to return the current state of instances.
However, you still need to periodically call the API and store the historical data yourself.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论