Integrate Amazon CloudWatch Metric Streams

Dynatrace integration with Amazon CloudWatch Metric Streams provides a simple and safe way to ingest AWS metrics. Amazon CloudWatch Metric Streams allows all metrics issued in a given AWS region to be streamed through Kinesis Firehose to the Dynatrace API.

ActiveGate isn't required for this integration.

Prerequisites

  • Create an API token in your Dynatrace environment and enable the Ingest metrics permission.
  • Determine the API URL for your environment:
    • For Dynatrace SaaS
      https://<your_environment_ID>.live.dynatrace.com
    • For Dynatrace Managed
      https://<your_domain>/e/<your_environment_ID>
    • For ActiveGate
      https://<your_active_gate_IP_or_hostname>:9999/e/<your_environment_ID>

To determine <your_environment_ID>, see environment ID.

Set up a Metric Streams client for your default region

To enable the Amazon CloudWatch Metric Streams integration, you need to deploy a small CloudFormation stack on your AWS account. The CloudFormation stack is a metric streams client distributed as a CloudFormation template.

To fetch the CloudFormation template and deploy it to your AWS account, run the command below. Be sure to replace <your_API_URL> and <your_API_token> with your own values. Consult the parameters table that follows for details.

Note: If you have AWS CLI configured, you can use a Bash-compliant shell. Otherwise, you can use CloudShell, which is available in the AWS console.

DYNATRACE_ENV_URL=<your_API_URL>
DYNATRACE_API_KEY=<your_API_token>
STACK_NAME=dynatrace-aws-metric-streams-client
REQUIRE_VALID_CERTIFICATE=true

wget https://dynatrace-aws-metric-streams-client.s3.amazonaws.com/dynatrace-aws-metric-streams-client.yaml && \
 aws cloudformation deploy --capabilities CAPABILITY_NAMED_IAM --template-file ./dynatrace-aws-metric-streams-client.yaml --stack-name $STACK_NAME --parameter-overrides DynatraceEnvironmentUrl=$DYNATRACE_ENV_URL DynatraceApiKey=$DYNATRACE_API_KEY RequireValidCertificate=$REQUIRE_VALID_CERTIFICATE

Deploy the Metric Streams client for other regions

The command above uses the default AWS CLI profile and its default region. You need one client stack for each region you want to monitor. Once deployed, the client starts streaming all metrics produced in its region.
To change the profile and region, you can export additional variables such as AWS_DEFAULT_REGION and AWS_PROFILE. For details on how to configure the AWS CLI, see Environment variables to configure the AWS CLI.

View metrics using preset dashboards

Once you deploy the Metric Streams client, you can use the predefined dashboards from the GitHub repository in the Dynatrace web UI to visualize your ingested data.

Prerequisites
  • Dynatrace versions 1.206+
  • Install Python 3 (no additional libraries are required)
  • Enable the Read configuration and Write configuration permissions for your API token

To upload preset dashboards from GitHub

  1. Get upload_dashboards.py from the GitHub repository.
curl -o upload_dashboards.py https://raw.githubusercontent.com/Dynatrace/snippets/master/product/dashboarding/upload_dashboards.py
  1. Create a dashboards directory next to upload_dashboards.py.

  2. Add any dashboard definition from GitHub to your dashboards directory.
    Note: Each dashboard definition is a single JSON-extension file located in the folders of the GitHub repository.

  3. Run the script below. Be sure to replace <your_dynatrace_cluster_version>, <your_API_token>, and <your_API_URL> with your own values. Consult the parameters table that follows for details.

python3 upload_dashboards.py --cluster-version <your_dynatrace_cluster_version> --dynatrace-api-token <your_API_token> --dynatrace-env-url <your_API_URL>

Example command

python3 upload_dashboards.py --cluster-version 206 --dynatrace-api-token 123456789 --dynatrace-env-url https://my-cluster.com/e/1755ddb2-7938-41a2-b6bd-096e0fdcd3e0