Categorygithub.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscloudwatchmetricsreceiver

# README

CloudWatch Metrics Receiver

Status
Stabilityunmaintained: metrics
Distributions[]
IssuesOpen issues Closed issues
Code Owners| Seeking more code owners!

Receives Cloudwatch metrics from AWS Cloudwatch via the AWS SDK for Cloudwatch Logs

Getting Started

This receiver uses the AWS SDK as mode of authentication, which includes Profile and IMDS authentication for EC2 instances.

Configuration

Top Level Parameters

ParameterNotestypeDescription
regionrequiredstringThe AWS recognized region string
profileoptionalstringThe AWS profile used to authenticate, if none is specified the default is chosen from the list of profiles
IMDSEndpointoptionalstringThe IMDS endpoint to authenticate to AWS
poll_intervaldefault=1mdurationThe duration waiting in between requests
metricsoptionalMetricsConfiguration for metrics ingestion of this receiver

Metrics Parameters

ParameterNotestypeDescription
namedrequiredSee Named ParametersConfiguration for Named Metrics, by default no metrics are collected

Named Parameters

ParameterNotestypeDescription
namespacerequiredstringAWS Metric namespace, all AWS namespaces are prefixed with AWS, eg: AWS/EC2 for EC2 metrics
metric_namerequiredstringAWS metric name
perioddefault=5mdurationAggregation period
aws_aggregationdefault=sumstringtype of AWS aggregation, eg: sum, min, max, average
dimensionsoptionalsee Dimensions ParametersConfiguration for metric dimensions

Dimension Parameters

ParameterNotestypeDescription
namerequiredstringDimensions name, can't start with a colon
valuerequiredstringDimension value

Named Example

awscloudwatchmetrics:
  region: us-east-1
  poll_interval: 1m
  metrics:
    named:
      - namespace: "AWS/EC2"
        metric_name: "CPUUtilization"
        period: "5m"
        aws_aggregation: "Sum"
        dimensions:
          - Name: "InstanceId"
            Value: "i-1234567890abcdef0"
      - namespace: "AWS/S3"
        metric_name: "BucketSizeBytes"
        period: "5m"
        aws_aggregation: "p99"
        dimensions:
          - Name: "BucketName"
            Value: "OpenTelemetry"
          - Name: "StorageType"
            Value: "StandardStorage"

Sample Configs

receivers:
  awscloudwatchmetrics:
    region: eu-west-1
    poll_interval: 10m
    metrics:
      named:
        - namespace: "AWS/EC2"
          metric_name: "CPUUtilization"
          period: "5m"
          aws_aggregation: "Sum"
          dimensions:
            - Name: "InstanceId"
              Value: "i-035e091c31292427a"

processors:

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [awscloudwatchmetrics]
      processors: []
      exporters: [debug]

AWS Costs

This receiver uses the GetMetricData API call, this call is not in the AWS free tier. Please refer to Amazon's pricing for further information about expected costs.

Troubleshooting / Debugging

My metrics are intermittent / not receiving any metrics

Try a bigger poll_interval. CloudWatch returns no data if the period of the metric, by default for AWS supplied metrics, it's 300 seconds (5 minutes). Try out a period of 600 seconds and a poll interval of 600 seconds.

Help, I'm getting IAM permission denied

Make sure your IAM role/user has the required permissions:

"cloudwatch:GetMetricData",
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics"

The following IAM permissions are required for transit gateways to work:

"ec2:DescribeTags",
"ec2:DescribeInstances",
"ec2:DescribeRegions",
"ec2:DescribeTransitGateway*"

# Functions

NewFactory creates a factory for awscloudwatchmetrics receiver.

# Structs

Config is the overall config structure for the awscloudwatchmetricsreceiver.
MetricDimensionConfig is the configuration for the metric dimensions.
MetricsConfig is the configuration for the metrics part of the receiver added this so we could expand to other inputs such as autodiscover.
NamesConfig is the configuration for the metric namespace and metric names https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html.