从 aws cloudwatch 中删除自定义指标

remove a custom metrics from aws cloudwatch

我已经通过 SDK 成功创建了自定义指标,但我无法删除它 我无法从 Web 控制台中找到删除它的选项(也从 SDK 中,我找不到 remove/cancel 它的方法)

//the code is not important, i've pasted it just to show it works

IAmazonCloudWatch client = new AmazonCloudWatchClient(RegionEndpoint.EUWest1);

List<MetricDatum> data = new List<MetricDatum>();

 data.Add(new MetricDatum()
 {
      MetricName = "PagingFilePctUsage",
      Timestamp = DateTime.Now,
      Unit = StandardUnit.Percent,
      Value = percentPageFile.NextValue()
 });

 data.Add(new MetricDatum()
 {
      MetricName = "PagingFilePctUsagePeak",
      Timestamp = DateTime.Now,
      Unit = StandardUnit.Percent,
      Value = peakPageFile.NextValue()
 });


 client.PutMetricData(new PutMetricDataRequest()
 {
      MetricData = data,
      Namespace = "mycompany/myresources"
 });

它创建了一个名为 "mycompany/myresources" 的指标,但我无法删除它

A​​mazon CloudWatch 指标保留 15 个月

来自Amazon CloudWatch FAQs - Amazon Web Services (AWS)

CloudWatch 保留指标数据如下:

  • Data points with a period of less than 60 seconds are available for 3 hours. These data points are high-resolution custom metrics.
  • Data points with a period of 60 seconds (1 minute) are available for 15 days
  • Data points with a period of 300 seconds (5 minute) are available for 63 days
  • Data points with a period of 3600 seconds (1 hour) are available for 455 days (15 months)

因此,就假装您的旧指标不存在吧。大多数图表和警报仅回顾 24 小时,因此除了在指标列表中显示为名称外,通常不会注意到旧指标。