BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeAWS Certified DevOps Engineer - Professional (DOP-C02)AWS CloudWatch Agent: Collecting Custom Metrics (Study Guide)
Study Guide875 words

AWS CloudWatch Agent: Collecting Custom Metrics (Study Guide)

Collecting custom metrics (for example, using the CloudWatch agent)

AWS CloudWatch Agent: Collecting Custom Metrics

This study guide covers the configuration and deployment of the CloudWatch agent to collect system-level and application-level metrics, a critical skill for the AWS Certified DevOps Engineer – Professional (DOP-C02) exam.

Learning Objectives

After studying this guide, you will be able to:

  • Differentiate between standard metrics and custom metrics.
  • Identify the specific system-level metrics only available via the CloudWatch Agent.
  • Choose the appropriate installation method (CLI, SSM, or CloudFormation).
  • Configure the agent to ingest application metrics using StatsD and collectd.
  • Compare the CloudWatch Agent with the SSM Agent and custom scripts.

Key Terms & Glossary

  • Custom Metric: Any metric not automatically collected by AWS services (e.g., Memory utilization). These are billed per metric per month.
  • StatsD: An open-source network daemon for aggregating and pushing application metrics, supported by the CloudWatch Agent on Linux and Windows.
  • collectd: A Unix daemon that collects system performance statistics, supported by the CloudWatch Agent on Linux only.
  • Namespace: A container for CloudWatch metrics (e.g., CWAgent is the default for the agent).
  • Dimension: A name/value pair that is part of a metric's identity (e.g., InstanceId or InstanceType).

The "Big Idea"

By default, CloudWatch only sees what the hypervisor sees (CPU, Network In/Out, Disk Metadata). It cannot see inside the Operating System. The CloudWatch Agent acts as a bridge, granting visibility into the "black box" of the OS (Memory, Disk Space) and the internal performance of your applications. This data is essential for high-fidelity auto-scaling and root cause analysis.

Formula / Concept Box

ConceptRule / Detail
Metric ResolutionStandard (60s) vs. High Resolution (1s). High resolution is often needed for DevOps real-time monitoring.
Billing RuleMetrics sent via the Agent are billed as Custom Metrics.
OS SupportLinux supports both StatsD and collectd; Windows supports StatsD only.
Default NamespaceCWAgent (Can be customized in the JSON configuration).

Hierarchical Outline

  1. Metric Sources
    • Hypervisor Metrics: CPU, Network, Status Checks (Automatic/Free).
    • Agent Metrics: Memory utilization, Disk space used, Swap usage (Custom/Paid).
    • Application Metrics: Custom logs and telemetry via StatsD/collectd.
  2. The CloudWatch Agent
    • Function: Collects system-level metrics + logs.
    • Installation:
      • CLI: Manual installation for one-off instances.
      • SSM: Recommended for fleet-wide management using the AWS-ConfigureAWSPackage document.
      • CloudFormation: For Infrastructure-as-Code (IaC) consistency.
  3. Protocols & Integration
    • StatsD: Cross-platform (Linux/Windows).
    • collectd: Linux-specific.
  4. Security & Permissions
    • IAM Role: Instances require CloudWatchAgentServerPolicy to push data.

Visual Anchors

Metric Data Flow

Loading Diagram...
Figure 1 — Mermaid diagram

Monitoring Visibility Layers

Compiling TikZ diagram…
⏳
Running TeX engine…
This may take a few seconds
Figure 2 — TikZ diagram

Definition-Example Pairs

  • Standard Resolution: Metrics with 1-minute granularity.
    • Example: Default EC2 CPU Utilization metrics.
  • High Resolution: Metrics with 1-second granularity.
    • Example: Monitoring a flash sale application where a 10-second spike in memory could crash the server.
  • Dimension-based Filtering: Segregating metrics by specific attributes.
    • Example: Viewing memory usage specifically for InstanceID: i-123456 rather than an aggregate of the whole Auto Scaling Group.

Worked Example: Deploying via SSM

Scenario: You need to install the CloudWatch agent on 50 EC2 instances across two regions.

  1. IAM Setup: Attach the CloudWatchAgentServerPolicy to the IAM Role used by the EC2 instances.
  2. Parameter Store: Save the agent configuration (JSON) in the SSM Parameter Store (e.g., name it AmazonCloudWatch-linux).
  3. Installation: Use SSM Run Command with the AWS-ConfigureAWSPackage document. Set the action to Install and name to AmazonCloudWatchAgent.
  4. Configuration: Use SSM Run Command with the AmazonCloudWatch-ManageAgent document. Point to the Parameter Store name created in Step 2.
  5. Verification: Check the CloudWatch Console under the CWAgent namespace to see incoming data.

Checkpoint Questions

  1. Which protocol is supported for custom application metrics on Windows servers using the CloudWatch Agent?
  2. What IAM policy is required for an EC2 instance to send metrics to CloudWatch via the agent?
  3. True/False: Standard metrics (like CPUUtilization) provided by the hypervisor are billed as custom metrics.
  4. How does the CloudWatch Agent handle log files?
▶Click to reveal answers
  1. StatsD (collectd is Linux-only).
  2. CloudWatchAgentServerPolicy.
  3. False. Only metrics sent by the agent or custom API calls are "Custom Metrics".
  4. It can tail log files and send them to CloudWatch Logs groups.

Muddy Points & Cross-Refs

  • CW Agent vs. SSM Agent: People often confuse these. The SSM Agent is for management (running commands, patching), while the CW Agent is for telemetry (metrics, logs). You use the SSM Agent to install the CW Agent.
  • Billing Trap: Each unique combination of dimensions counts as a separate custom metric. Be careful when adding dimensions like ProcessID, as it can lead to thousands of billed metrics.
  • Cross-Ref: See Exam Domain IV: Monitoring and Logging for more on Log Subscriptions and Metric Filters.

Comparison Tables

Metric Collection Methods

FeatureCloudWatch AgentStandard MetricsCustom Scripts (SDK)
Memory StatsYesNoYes
Disk UsageYesNoYes
App LogsYesNoNo (requires SDK)
Setup EffortModerate (Agent config)ZeroHigh (Coding required)
Best ForFleet-wide OS monitoringBasic health checksSpecific niche logic
All AWS Certified DevOps Engineer - Professional (DOP-C02) Study Resources

Related Notes

  • Mastering AWS Alerting and Automated Remediation1,050 words
  • Study Guide: Analyzing Failed Deployments in AWS940 words
  • Incident Analysis: Troubleshooting Failed Processes in AWS1,050 words
  • Mastering AWS Monitoring & Security Analytics: Logs, Metrics, and Findings1,050 words
  • AWS Log Analysis: Athena, CloudWatch Insights, and OpenSearch920 words
  • Analyzing Real-Time Log Streams with Amazon Kinesis Data Streams985 words
  • CloudWatch Anomaly Detection Alarms: Professional Study Guide820 words
  • AWS Application Storage Patterns: EBS, EFS, and S31,054 words
  • Lab: Automating Security Controls and Data Protection with AWS Secrets Manager and Config942 words
  • Master Study Guide: Automating Security Controls & Data Protection (AWS DOP-C02)1,184 words
  • Mastering AWS CloudFormation StackSets: Multi-Account & Multi-Region Orchestration895 words
  • Mastering System Configuration Changes in AWS945 words

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up.

Start Studying

Ready to study AWS Certified DevOps Engineer - Professional (DOP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free
AWS Certified DevOps Engineer - Professional (DOP-C02) ResourcesExplore All HivesBlogHome

© 2026 BrainyBee. Free AI-powered exam prep.

Loading Diagram...
Flowchart, top to bottom. EC2 / On-Prem Instance connects to CloudWatch Agent. B connects to CloudWatch Metrics ("OS Stats (Memory/Disk)"). B connects to C ("App Stats (StatsD/collectd)"). B connects to CloudWatch Logs ("Log Files"). C connects to Alarms & Dashboards.