Our Customers who use AWS services frequently ask, “Why is the metric unavailable in CloudWatch console?”
At Bobcares, we help our customers with similar AWS issues as a part of our AWS Support Services.
Today let’s see how our Support Engineers help our customers with this metric unavailable issue.
Event-driven and schedule-based metrics
Metrics are grouped first by namespace, and then by the various dimension combinations within each namespace. For example, we can see all EC2 metrics, EC2 metrics grouped by instance, or EC2 metrics grouped by Auto Scaling group.
The metrics can be event-driven or schedule-based:
Event-driven metrics: Here the source sends data points only when there’s something to report. That is, a data point is sent to the HTTTP_CODE_ELB_5XX_COUNT metric from the Elastic Load Balancing service only when there are errors.
Schedule-based metrics: Here irrespective of the value of the data points, the source sends data to CloudWatch periodically.
For example, the Amazon EC2 service pushes data periodically for the CPUUtilization metric.
Metric unavailable in CloudWatch console
Before discussing how to fix the issue, let’s have a look at the issue.
If a metric is newly created, it might take up to fifteen minutes to appear the metric name in the console.
The CloudWatch console limits the search of metrics to two weeks if it has not had any new data points, so metrics do not appear in the console.
They also do not appear when we type their metric name or dimension names in the search box in the All metrics tab in the console.
The best way we follow to retrieve these metrics is with the get-metric-data or get-metric-statistics commands in the AWS CLI.
How to retrieve metrics
If a metric is not available in the Amazon CloudWatch console, Our Support Techs follow some methods to retrieve the data points.
Let’s have a look at the procedures.
Methods to resolve ‘metric unavailable in CloudWatch console’
- The best way that we follow to retrieve the metric is by using AWS CLI or AWS SDK to make a GetMetricData or GetMetricStatistics API call for the metric. Also make sure to specify the correct namespace, metric name, dimensions, and timeframe.
- We can also resolve this issue by selecting any currently available metric on the Metric list of the CloudWatch console. Then, edit the browser URL to include the namespace, metric name, and dimension of the unavailable metric in the console.
- If the old metric we want to view has a current metric with similar dimensions, we can view that current similar metric and then choose the Source tab, and change the metric name and dimension fields to the ones that we want. Finally, choose Update to view the metric that’s not listed in the console.
Also, specify the “period” or time range to retrieve the metric.
CloudWatch applies the following retention settings on its data points:
Data points with a period of fewer 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 minutes) are available for 63 days.
Data points with a period of 3,600 seconds (1 hour) are available for 455 days (15 months).
We can also create alarms on unavailable metrics in the CloudWatch console using either of the following methods:
- With AWS CLI or AWS SDK, we can make a PutMetricAlarm API call. Also make sure to use the correct namespace, metric name, and dimensions for the metric.
- At the first step (“Specify metric and conditions”) of creating a CloudWatch alarm in the console, we can edit the Metric Name and Dimension values. But we cannot edit the key names for the dimension and namespace using this method.
To edit the namespace, choose Edit, and then choose the Source tab. Update the namespace, and finally choose Update.
[Need any further assistance in fixing AWS errors? – We’re available 24*7]
To conclude, today we saw the steps that our Support Techs follow to resolve the ‘metric unavailable in CloudWatch console’ issue.