AgentSkillsCN

datadog

查询 Datadog APM 跟踪数据、日志、指标、SLO 指标、安全信号以及服务目录;创建监控器、仪表板和合成测试;管理事件与工作流。适用于性能问题排查、日志搜索、SLO 检查、成本分析,或实现 Datadog 运维的自动化操作。

SKILL.md
--- frontmatter
name: datadog
description: Query Datadog APM traces, logs, metrics, SLOs, security signals, and service catalog. Create monitors, dashboards, and synthetic tests. Manage incidents and workflows. Use when investigating performance issues, searching logs, checking SLOs, analyzing costs, or automating Datadog operations.

Datadog Operations Skill

Comprehensive Datadog automation: query APM/logs/metrics/RUM/database, create monitors/dashboards/synthetics, manage incidents, trigger workflows, analyze costs and LLM usage.

Quick Setup

macOS

bash
./setup.sh

Linux

bash
./setup-linux.sh

Windows (PowerShell as Administrator)

powershell
.\setup-windows.ps1

Platform-Specific Setup

macOS

Install jq (required for JSON processing):

bash
# Homebrew (recommended)
brew install jq

# MacPorts
sudo port install jq

# Direct binary (Apple Silicon)
curl -L -o ~/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64
chmod +x ~/bin/jq

# Direct binary (Intel)
curl -L -o ~/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64
chmod +x ~/bin/jq

Set environment variables in ~/.zshrc:

bash
export DD_API_KEY="your_api_key"
export DD_APP_KEY="your_application_key"
export DD_SITE="datadoghq.com"

Linux

Install dependencies:

bash
# Debian/Ubuntu
sudo apt-get install -y jq curl bc

# Fedora/RHEL
sudo dnf install -y jq curl bc

# Arch
sudo pacman -S jq curl bc

Set environment variables in ~/.bashrc:

bash
export DD_API_KEY="your_api_key"
export DD_APP_KEY="your_application_key"
export DD_SITE="datadoghq.com"

Windows

Option 1: WSL (Recommended)

bash
wsl --install
# Then run Linux setup inside WSL
./setup-linux.sh

Option 2: Git Bash Install Git for Windows, then run ./setup.sh in Git Bash.

Option 3: Native PowerShell

powershell
# Install jq
winget install jqlang.jq
# Or: choco install jq

# Set environment variables
[Environment]::SetEnvironmentVariable("DD_API_KEY", "your_key", "User")
[Environment]::SetEnvironmentVariable("DD_APP_KEY", "your_app_key", "User")

Use Python scripts directly: python python\script_name.py

Required Permissions

Get keys from Datadog → Organization Settings → API Keys / Application Keys

For workflow automation (trigger-workflow): Enable "Actions API Access" on your app key: Datadog → Organization Settings → Application Keys → Click key → Enable "Actions API Access"

Quick Reference

Investigation Scripts

ScriptPurposeExample
query-apm.shFind slow endpointsbash scripts/query-apm.sh --service my-service --duration 1h
search-logs.shSearch logs for errorsbash scripts/search-logs.sh --query "status:error" --duration 1h
query-security-signals.shFind security threatsbash scripts/query-security-signals.sh --severity critical
query-watchdog.shAnomaly detectionbash scripts/query-watchdog.sh --service my-service
query-metrics.shFetch metrics databash scripts/query-metrics.sh --metric "system.cpu.user"
analyze-usage-cost.shFinOps cost analysisbash scripts/analyze-usage-cost.sh --duration 30d
analyze-llm.shLLM observabilitybash scripts/analyze-llm.sh --service my-llm-app
query-slos.shSLO statusbash scripts/query-slos.sh --service payment-api
query-service-catalog.shService metadatabash scripts/query-service-catalog.sh list
query-database.shDB performancebash scripts/query-database.sh --host postgres-prod
query-rum.shFrontend performancebash scripts/query-rum.sh --application abc-123
query-kubernetes.shK8s workloadsbash scripts/query-kubernetes.sh --cluster prod
query-containers.shContainer metricsbash scripts/query-containers.sh --duration 1h
query-network.shNetwork monitoringbash scripts/query-network.sh --duration 1h

Automation Scripts

ScriptPurposeExample
manage-monitors.shCreate/mute monitorsbash scripts/manage-monitors.sh list
create-dashboard.shGenerate dashboardsbash scripts/create-dashboard.sh --service my-service
trigger-workflow.shExecute workflowsbash scripts/trigger-workflow.sh list
manage-incidents.shIncident managementbash scripts/manage-incidents.sh list
manage-synthetics.shSynthetic testsbash scripts/manage-synthetics.sh list
manage-on-call.shOn-call schedulingbash scripts/manage-on-call.sh list
manage-status-pages.shStatus pagesbash scripts/manage-status-pages.sh list
verify-setup.shValidate configbash scripts/verify-setup.sh

Workflows

Investigate Production Issue

bash
bash scripts/query-watchdog.sh --service affected-service --duration 24h
bash scripts/query-apm.sh --service affected-service --duration 1h
bash scripts/search-logs.sh --service affected-service --status error --duration 1h

Check Cost & Usage

bash
bash scripts/analyze-usage-cost.sh --duration 30d --product all
bash scripts/analyze-usage-cost.sh --duration 30d | jq '.recommendations[] | select(.priority == "high")'

Monitor LLM Application

bash
bash scripts/analyze-llm.sh --service my-genai-app --duration 24h

Output Format

All scripts return structured JSON to stdout, status messages to stderr:

bash
bash scripts/query-apm.sh --service my-service 2>/dev/null | jq '.summary'

Python Alternative

Python versions available in python/ directory:

bash
python3 -m venv .venv && source .venv/bin/activate
pip install -r python/requirements.txt
python python/query_apm.py --service my-service --json

Go CLI Alternative

Single-binary CLI available in ../dd-skill-test-go/:

bash
# Native on all platforms - no dependencies
datadog-cli apm --service my-service --duration 1h
datadog-cli logs --query "status:error"
datadog-cli monitors list
datadog-cli health

See ../dd-skill-test-go/README.md for installation.

Notes

  • Advanced Scripts: Some scripts require Python. Run ./setup.sh first.
  • Windows: Use WSL, Git Bash, or Python scripts directly.
  • Go CLI: Recommended for Windows - native binary, no dependencies.