Path: blob/main/docs/sources/static/configuration/integrations/cloudwatch-exporter-config.md
4096 views
---
---
cloudwatch_exporter_config
Overview
The cloudwatch_exporter_config
block configures the cloudwatch_exporter
integration, which is an embedded version of YACE
. Use the cloudwatch_exporter
to collect AWS CloudWatch metrics.
This integration lets you scrape CloudWatch metrics in a set of configurations that we will call jobs. There are two kind of jobs: discovery
and static
.
Authentication
The agent must be running in an environment with access to AWS. The exporter uses the AWS SDK for Go and provides authentication via AWS's default credential chain. Regardless of the method used to acquire the credentials, some permissions are needed for the exporter to work.
The following IAM permissions are required for the Transit Gateway attachment (tgwa) metrics to work.
The following IAM permission is required to discover tagged API Gateway REST APIs:
The following IAM permissions are required to discover tagged Database Migration Service (DMS) replication instances and tasks:
To use all of the integration features, use the following AWS IAM Policy:
Configuration options
Configuration reference:
discovery_job
A discovery job allows one to just define the AWS service to scrape, and the metrics under that service/namespace to retrieve. The agent will find AWS resources in the specified service for which to scrape these metrics, label them appropriately, and export them to Prometheus. For example, if we wanted to scrape CPU utilization and network traffic metrics, from all AWS EC2 instances:
Configuration reference:
static_job
A static job allows one to scrape an individual CloudWatch metric. For that, metrics needs to be fully qualified, specifying the following:
namespace
: For exampleAWS/EC2
,AWS/EBS
,CoolApp
if it were a custom metric, etc.dimensions
: CloudWatch identifies a metrics by a set of dimensions. For example, allAWS/EC2
metrics are identified by theInstanceId
dimension.metrics
: Metric name and statistics.
For example, if one wants to scrape the same metrics in the discovery example, but for a specific AWS EC2 instance:
All dimensions need to be specified when scraping single metrics like the example above. For example AWS/Logs
metrics require Resource
, Service
, Class
, and Type
dimensions to be specified. Same applies to CloudWatch custom metrics, all dimensions attached to a metric when saved in CloudWatch are required.
Configuration reference:
aws_role
Represents an AWS IAM Role. Required when configuring a job. If omitted the AWS role that the credentials configured in the environment posses will be used.
This is useful when scraping metrics from different AWS accounts with a single pair of credentials. In this case, a different role is configured for the agent to assume prior to calling AWS APIs, therefore, the credentials configured in the system need permission to assume the target role. See this documentation on how to configure this.
aws_dimension
Represents an AWS CloudWatch Dimension.
aws_tag
Represents an AWS Tag.
metric
Represents an AWS Metrics to scrape, under the context of a job. To see available metrics, AWS does not keep a documentation page with all available metrics. Follow this guide on how to explore metrics, to easily pick the ones you need.
Period
Period controls how far back in time CloudWatch metrics are considered, during each agent scrape. We can split how these settings affects the produced values in two different scenarios.
If all metrics within a job (discovery or static) have the same Period
value configured, CloudWatch APIs will be requested for metrics from the scrape time, to Periods
seconds in the past. The values of these are exported to Prometheus.
On the other hand, if metrics with different Periods
are configured under an individual job, this works differently. First, two variables are calculated aggregating all periods: length
, taking the maximum value of all periods, and the new period
value, taking the minimum of all periods. Then, CloudWatch APIs will be requested for metrics from now - length
to now
, aggregating each in samples for period
seconds. For each metrics, the most recent sample is exported to CloudWatch.
Supported services in discovery jobs
The following is a list of AWS services that are supported in cloudwatch_exporter
discovery jobs. When configuring a discovery job, the type
field of each discovery_job
must match either the desired job namespace or alias.
Namespace:
AWS/CertificateManager
or Alias:acm
Namespace:
AmazonMWAA
or Alias:airflow
Namespace:
AWS/ApplicationELB
or Alias:alb
Namespace:
AWS/AppStream
or Alias:appstream
Namespace:
AWS/Backup
or Alias:backup
Namespace:
AWS/ApiGateway
or Alias:apigateway
Namespace:
AWS/AmazonMQ
or Alias:mq
Namespace:
AWS/AppSync
or Alias:appsync
Namespace:
AWS/Athena
or Alias:athena
Namespace:
AWS/AutoScaling
or Alias:asg
Namespace:
AWS/ElasticBeanstalk
or Alias:beanstalk
Namespace:
AWS/Billing
or Alias:billing
Namespace:
AWS/Cassandra
or Alias:cassandra
Namespace:
AWS/CloudFront
or Alias:cloudfront
Namespace:
AWS/Cognito
or Alias:cognito-idp
Namespace:
AWS/DMS
or Alias:dms
Namespace:
AWS/DDoSProtection
or Alias:shield
Namespace:
AWS/DocDB
or Alias:docdb
Namespace:
AWS/DX
or Alias:dx
Namespace:
AWS/DynamoDB
or Alias:dynamodb
Namespace:
AWS/EBS
or Alias:ebs
Namespace:
AWS/ElastiCache
or Alias:ec
Namespace:
AWS/EC2
or Alias:ec2
Namespace:
AWS/EC2Spot
or Alias:ec2Spot
Namespace:
AWS/ECS
or Alias:ecs-svc
Namespace:
ECS/ContainerInsights
or Alias:ecs-containerinsights
Namespace:
AWS/EFS
or Alias:efs
Namespace:
AWS/ELB
or Alias:elb
Namespace:
AWS/ElasticMapReduce
or Alias:emr
Namespace:
AWS/EMRServerless
or Alias:emr-serverless
Namespace:
AWS/ES
or Alias:es
Namespace:
AWS/Firehose
or Alias:firehose
Namespace:
AWS/FSx
or Alias:fsx
Namespace:
AWS/GameLift
or Alias:gamelift
Namespace:
AWS/GlobalAccelerator
or Alias:ga
Namespace:
Glue
or Alias:glue
Namespace:
AWS/IoT
or Alias:iot
Namespace:
AWS/Kafka
or Alias:kafka
Namespace:
AWS/KafkaConnect
or Alias:kafkaconnect
Namespace:
AWS/Kinesis
or Alias:kinesis
Namespace:
AWS/KinesisAnalytics
or Alias:kinesis-analytics
Namespace:
AWS/Lambda
or Alias:lambda
Namespace:
AWS/MediaTailor
or Alias:mediatailor
Namespace:
AWS/Neptune
or Alias:neptune
Namespace:
AWS/NetworkFirewall
or Alias:nfw
Namespace:
AWS/NATGateway
or Alias:ngw
Namespace:
AWS/NetworkELB
or Alias:nlb
Namespace:
AWS/PrivateLinkEndpoints
or Alias:vpc-endpoint
Namespace:
AWS/PrivateLinkServices
or Alias:vpc-endpoint-service
Namespace:
AWS/Prometheus
or Alias:amp
Namespace:
AWS/RDS
or Alias:rds
Namespace:
AWS/Redshift
or Alias:redshift
Namespace:
AWS/Route53Resolver
or Alias:route53-resolver
Namespace:
AWS/Route53
or Alias:route53
Namespace:
AWS/S3
or Alias:s3
Namespace:
AWS/SES
or Alias:ses
Namespace:
AWS/States
or Alias:sfn
Namespace:
AWS/SNS
or Alias:sns
Namespace:
AWS/SQS
or Alias:sqs
Namespace:
AWS/StorageGateway
or Alias:storagegateway
Namespace:
AWS/TransitGateway
or Alias:tgw
Namespace:
AWS/VPN
or Alias:vpn
Namespace:
AWS/WAFV2
or Alias:wafv2
Namespace:
AWS/WorkSpaces
or Alias:workspaces