My Amazon CloudWatch metrics show missing data points. I want to identify the cause and resolve the issue.
Resolution
The troubleshooting steps depend on whether you use AWS service metrics or custom metrics. Identify your metric type and then take the following actions.
AWS service metrics
For AWS service metrics, missing data points might be expected behavior that depends on how the service publishes metrics. Some services publish metrics continuously, while others publish metrics under certain conditions. Refer to the service's monitoring documentation to determine whether the missing data points are normal based on how the service publishes metrics.
Custom metrics
Note: Your applications send metrics to CloudWatch. CloudWatch doesn't retrieve them. To identify issues with custom metrics, check your application logs or the service that publishes the metrics.
Take the following actions based on how you publish custom metrics:
- If your application uses the PutMetricData API, then check the application logs on your source for errors.
- If you use the CloudWatch agent, then check the agent logs on your server for errors. For more information, see Troubleshooting the CloudWatch agent.
- If you use Container Insights, then verify that you completed the setup of Container Insights. Metrics don't appear until you complete the Container Insights set up. If all or some pod metrics are missing, then check the agent logs on your container for errors. For more information, see Troubleshooting Container Insights.
- If you use an embedded metric format to extract custom metrics from logs, then use the embedded metric format specification for your log structure. Also, use client libraries to generate embedded metric format logs. Then, use the PutLogEvents API or the CloudWatch agent to send the logs to CloudWatch Logs. For more information, see Embedding metrics within logs.
- If you use a metric filter to extract terms and patterns from log data, then verify that you defined the correct filter pattern syntax. Also, verify that the incoming log data matches the defined pattern. Filters publish the metric data points only for events that occur after you create the filter. For more information, see Creating metrics from log events using filters.
- Check the metric retention periods when you retrieve the data points from CloudWatch. CloudWatch aggregates data points that you publish with a shorter period for long-term storage. Adjust the retention period to see whether data points appear on the graph. For more information, see Metrics retention.
- If your metrics haven't received new data points in the past two weeks, then run the get-metric-data or get-metric-statistics AWS Command Line Interface (AWS CLI) commands to retrieve them. You can also run the commands for metrics you can't find in the AWS Management Console.
Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.