agentleFS
Cogni-AI-OUCogni-AI-OU/cogni-ai-agent-skills/datadog-api/SKILL.md

datadog-api

Skill4 starsChanged 6 months agoMITView on GitHub

Execute Datadog API requests to fetch live objects, metrics, or monitor statuses using cURL and API keys. You MUST load this skill when interacting with the Datadog API.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When querying Datadog metrics, logs, or traces directly from the command line in an automated script.

    line 14
  2. Distinctive:

    When you need to fetch a dashboard configuration JSON to inspect or backup its definition.

    line 16
  3. Very specific:

    When full MCP observability tools (datadog-mcp) are available, as they natively format data for LLM context windows.

    line 20
  4. Distinctive:

    If the project uses Pulumi or Terraform for Datadog resource creation (use the respective Infrastructure-as-Code skill).

    line 21
  5. Distinctive:

    When a simple web UI link to the Datadog dashboard would suffice for a human user.

    line 22
  6. Very specific:

    Verify Credentials: Ensure DD-API-KEY and DD-APPLICATION-KEY are available in the environment.

    line 32
  7. Very specific:

    Determine Datadog Site: Default is datadoghq.com, but it could be datadoghq.eu, us3.datadoghq.com, etc.

    line 33
  8. Very specific:

    Execute API Call: Use curl to construct the API request, passing necessary headers and query parameters.

    line 34
  9. Very specific:

    Process Response: Use tools like jq to parse and extract relevant data from the JSON response.

    line 35
  10. Distinctive:

    Secure Headers: Always pass keys via headers, never in the URL path.

    line 39
  11. Very specific:

    Data Pruning: Use jq or python to prune large JSON responses, especially when fetching dashboards or monitors.

    line 40
  12. Distinctive:

    Search for Monitors by tag or name:

    line 53
  13. Very specific:

    Avoid logging or exposing DD-API-KEY or DD-APPLICATION-KEY in clear text outputs.

    line 89
  14. Very specific:

    Do not fetch massive metric datasets without strict from and to bounds to avoid overloading the context window.

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: datadog-api

<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->

Execute Datadog API requests to fetch live objects, metrics, or monitor statuses.

When to Use

  • When querying Datadog metrics, logs, or traces directly from the command line in an automated script.
  • To retrieve and analyze the status of Datadog monitors.
  • When you need to fetch a dashboard configuration JSON to inspect or backup its definition.

When Not to Use

  • When full MCP observability tools (datadog-mcp) are available, as they natively format data for LLM context windows.
  • If the project uses Pulumi or Terraform for Datadog resource creation (use the respective Infrastructure-as-Code skill).
  • When a simple web UI link to the Datadog dashboard would suffice for a human user.

Common Pitfalls

  • Paginating Endlessly: Running an API query that returns millions of log lines without using jq to truncate or filter the output, causing the agent to run out of memory.
  • Leaking API Keys: Accidentally echoing the DD-API-KEY or DD-APPLICATION-KEY in the terminal during debugging, exposing it in the workflow logs.
  • Incorrect Endpoint Region: Sending requests to datadoghq.com when the organization's Datadog instance is actually hosted on datadoghq.eu or us3.datadoghq.com, resulting in HTTP 403 or 404 errors.

Core Process

  1. Verify Credentials: Ensure DD-API-KEY and DD-APPLICATION-KEY are available in the environment.
  2. Determine Datadog Site: Default is datadoghq.com, but it could be datadoghq.eu, us3.datadoghq.com, etc. based on the target environment.
  3. Execute API Call: Use curl to construct the API request, passing necessary headers and query parameters.
  4. Process Response: Use tools like jq to parse and extract relevant data from the JSON response.

Core Principles

  • Secure Headers: Always pass keys via headers, never in the URL path.
  • Data Pruning: Use jq or python to prune large JSON responses, especially when fetching dashboards or monitors.
  • Pagination: Handle pagination when querying lists of items using start or page parameters.

Commands / Usage Patterns

Fetch a specific Dashboard by ID:

curl -s -X GET "https://api.datadoghq.com/api/v1/dashboard/<dashboard_id>" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Search for Monitors by tag or name:

curl -s -X GET "https://api.datadoghq.com/api/v1/monitor/search?query=tag:env:prod" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Query Timeseries Metrics (Unix epoch timestamps):

curl -s -X GET "https://api.datadoghq.com/api/v1/query?query=system.cpu.idle{*}&from=$(date -d '1 hour ago' +%s)&to=$(date +%s)" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

Get a specific Monitor's details:

curl -s -X GET "https://api.datadoghq.com/api/v1/monitor/<monitor_id>" \
  -H "DD-API-KEY: ${DD_API_KEY}" \
  -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"

References

Diagnostics and Troubleshooting

  • 403 Forbidden: Check DD-API-KEY and DD-APPLICATION-KEY validity and ensure they match the correct Datadog site (datadoghq.com vs datadoghq.eu).
  • 429 Too Many Requests: Implement exponential backoff if hitting API rate limits.
  • 404 Not Found: Verify the ID or endpoint path.

What to Avoid

  • Avoid logging or exposing DD-API-KEY or DD-APPLICATION-KEY in clear text outputs.
  • Do not fetch massive metric datasets without strict from and to bounds to avoid overloading the context window.

Limitations

  • The agent context window can be easily overwhelmed by full dashboard JSONs. Always filter the response with jq when possible.
  • For retrieving telemetry (logs, metrics, traces, monitors), always prefer optimized MCP-based tools over raw API calls if available, as they are specifically designed to optimize data size for the agent's context window.

Related Skills

  • datadog-agent: Configure the Datadog Agent for metric and log collection.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.