如何知道在GCP中一个实例是被扩展还是被缩小的

huangapple go评论68阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年6月26日 19:57:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76556456.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定