如何引用 EKS 的容器洞察力创建的 CloudWatch 指标?
How to reference a CloudWatch metric created by container insights for EKS?
我看到一个例子,如何在ECS上进行引用:
我的目标是让它与 EKS 类似,获得“ContainerInsights”,如利用率、内存等。
如果有人能给我举个例子,我会很高兴。
谢谢
您可以通过 instantiating a Metric object. The list of EKS Container Insights metrics can be found in the docs 访问 CloudWatch 发布的任何指标。
所以,例如,
new cloudwatch.Metric({
metricName: 'node_cpu_usage_total',
namespace: 'ContainerInsights',
// if your EKS cluster is defined in CDK, you can also reference the
// dimensions dynamically (instead of hardcoding as shown in this example)
dimensions: { ClusterName: 'MyCluster', NodeName: 'MyNode' },
});
您可以随时查看 CloudWatch Metrics Explorer 中的指标,以发现要使用的正确指标名称和维度。
我看到一个例子,如何在ECS上进行引用:
我的目标是让它与 EKS 类似,获得“ContainerInsights”,如利用率、内存等。
如果有人能给我举个例子,我会很高兴。 谢谢
您可以通过 instantiating a Metric object. The list of EKS Container Insights metrics can be found in the docs 访问 CloudWatch 发布的任何指标。
所以,例如,
new cloudwatch.Metric({
metricName: 'node_cpu_usage_total',
namespace: 'ContainerInsights',
// if your EKS cluster is defined in CDK, you can also reference the
// dimensions dynamically (instead of hardcoding as shown in this example)
dimensions: { ClusterName: 'MyCluster', NodeName: 'MyNode' },
});
您可以随时查看 CloudWatch Metrics Explorer 中的指标,以发现要使用的正确指标名称和维度。