First Monitor - fleXRPL/datadog-monitor-deployer GitHub Wiki
Creating Your First Monitor
This guide will walk you through creating and deploying your first DataDog monitor using the DataDog Monitor Deployer.
Prerequisites
- DataDog Monitor Deployer installed (
pip install datadog-monitor-deployer
) - DataDog API and Application keys configured
- Basic understanding of DataDog monitors
Step 1: Create Your First Monitor Configuration
Create a file named monitor.yaml
with the following content:
monitors:
- name: "High CPU Usage Alert"
type: "metric alert"
query: "avg(last_5m):avg:system.cpu.user{*} > 80"
message: |
CPU usage is above 80%
{{#is_alert}}
System is experiencing high CPU usage.
Please investigate immediately.
{{/is_alert}}
{{#is_recovery}}
CPU usage has returned to normal levels.
{{/is_recovery}}
tags:
- "env:production"
- "service:web"
- "team:platform"
priority: 2
options:
notify_no_data: true
no_data_timeframe: 10
notify_audit: false
timeout_h: 0
evaluation_delay: 900
new_host_delay: 300
include_tags: true
require_full_window: false
renotify_interval: 60
thresholds:
critical: 80
warning: 70
ok: 60
Step 2: Validate Your Configuration
Before deploying, validate your monitor configuration:
dd-monitor validate monitor.yaml
Step 3: Deploy Your Monitor
Deploy your monitor to DataDog:
dd-monitor deploy monitor.yaml
Step 4: Verify the Monitor
- Log into your DataDog account
- Navigate to Monitors > Manage Monitors
- Find your newly created "High CPU Usage Alert" monitor
- Verify the configuration matches your YAML file
Understanding the Configuration
Let's break down the key components of the monitor configuration:
Basic Properties
name
: The display name of your monitortype
: The type of monitor (e.g., "metric alert", "log alert")query
: The monitor's detection querymessage
: The notification message (supports templating)
Tags and Priority
tags
: Labels for organizing and filtering monitorspriority
: Importance level (1-5, where 1 is highest)
Options
notify_no_data
: Whether to alert when data is missingevaluation_delay
: Delay before evaluating data pointsthresholds
: Alert and recovery thresholds
Next Steps
- Learn about different monitor types
- Explore templating options
- Understand best practices
- Set up automated deployments
Common Issues
Monitor Not Appearing
- Verify your API credentials
- Check the deployment command output
- Ensure the YAML syntax is correct
Incorrect Thresholds
- Verify the query syntax
- Check threshold values and operators
- Validate the configuration file