How do I graph older metrics that aren't listed on the CloudWatch console?

2 minute read
0

I want to graph older metrics that aren't listed on the Amazon CloudWatch console.

Short description

If a metric hasn't published data points for more than 14 days, then you can't view or retrieve the metric with the ListMetrics API. To view the metric, manually provide the metric source with the correct NameSpace, MetricName, and Dimensions that are associated with the metric.

Resolution

Note: Metric values are case sensitive.

To graph an older metric that's no longer listed on CloudWatch, complete the following steps:

  1. Open the CloudWatch console.

  2. In the navigation pane, in the Metrics section, choose All metrics.

  3. Choose Source, and then enter the JSON block for the metric that you want to graph. See the following examples.
    Example JSON to retrieve the CPUUtilization metric from a deleted Amazon Elastic Compute Cloud (Amazon EC2) instance:
    Note: Replace example-instance-id with your instance's ID and example-region with your AWS Region.

    {   "view": "timeSeries",
        "stacked": false,
        "metrics": [
            [ "AWS/EC2", "CPUUtilization", "InstanceId", "example-instance-id" ]
        ],
        "region": "example-region"}

    Example JSON to retrieve the RequestCount metric that contains LoadBalancer and AvailabilityZone dimensions from a deleted load balancer:
    Note: Replace example-lb-name with the name of the load balancer, example-az with your Availability Zone, and example-region with your Region.

    {   "view": "timeSeries",
        "stacked": false, 
        "metrics": [ 
            [ "AWS/ELB", "RequestCount", "LoadBalancerName", "example-lb-name", "AvailabilityZone", "example-az" ], 
            [ "AWS/ELB", "RequestCount", "LoadBalancerName", "example-lb-name", "AvailabilityZone", "example-az" ] 
        ],
        "region": "example-region"
    }
  4. (Optional) If there are multiple dimensions in the metric that you want to graph, then use the following format to include them in the metrics section:

    ["NameSpace", "MetricName", "Dimension Key1", "Dimension Value1", "Dimension Key2", "Dimension Value2", ... ]
  5. (Optional) To graph multiple metrics, make sure to add a comma after the end bracket. Then, add the following to the metrics section:

    ["NameSpace1", "MetricName1", "Dimension Key1", "Dimension Value1"], ["NameSpace2", "MetricName2", "Dimension Key2, "Dimension Value2"]
  6. Choose Graph metrics. If necessary, adjust the Time Range, Period, and Statistic settings.

Note: CloudWatch retains metric data based on the specified Period setting. Make sure that you adjust the period to retrieve your metrics as expected. For more information, see the Metrics retention section of Metrics.

Related information

Graph metrics manually on a CloudWatch dashboard

AWS OFFICIAL
AWS OFFICIALUpdated 25 days ago