Skip to content
Datadog Monitors

Datadog Monitors

v1.0.1
MIT
Repository Docs
markdown Development
datadogmonitorsalertingobservabilitysreon-call

Summary

Create and audit Datadog monitors from an agent via the pup CLI — with alerting rules that stop the usual flapping, unscoped and unowned monitors.

Features

  • List, inspect and create monitors through the pup CLI
  • Alerting rules that prevent flapping and unscoped queries
  • Recovery thresholds and runbook-bearing notification templates
  • jq audits for unowned and noisy monitors
  • Downtime-versus-edit guidance for planned silence
  • Refuses direct deletion — marks monitors for human review instead

Install This Skill

Add this skill to your favorite AI agent in a few steps.

Any AI agent

This skill is plain instructions — it works with any assistant that accepts custom instructions or system prompts.

  1. Copy the skill content with the button below.
  2. Paste it into your agent's instruction file or system prompt (for example AGENTS.md, .cursorrules, or a custom instructions field).
  3. Ask the agent to apply the skill whenever the task matches.

Skill Content

Markdown Content

Copy this content and use it with your preferred AI agent

---
name: dd-monitors
description: Monitor management - list, search, file-based create, and alerting best practices.
metadata:
  version: "1.0.1"
  author: datadog-labs
  repository: https://github.com/datadog-labs/agent-skills
  tags: datadog,monitors,alerting,alerts,dd-monitors
  globs: "**/datadog*.yaml,**/*monitor*"
  alwaysApply: "false"
---

# Datadog Monitors

Create, manage, and maintain monitors for alerting.


## Prerequisites
This requires pup in your path. See [Setup Pup](https://github.com/datadog-labs/agent-skills/tree/main?tab=readme-ov-file#setup-pup).

## Command Execution Order (Token-Efficient)

For scoped commands, use this order:

1. Check context first (prior outputs, conversation, saved values).
2. If a required value is missing, run a discovery command first.
3. If still ambiguous, ask the user to confirm.
4. Then run the target command.
5. Avoid speculative commands likely to fail.


## Quick Start

```bash
pup auth login
```

## Common Operations

### List Monitors

```bash
pup monitors list
pup monitors list --tags "team:platform"
```

### Get Monitor

```bash
pup monitors get <id>
```

### Create Monitor

```bash
pup monitors create --file monitor.json
```

### Silence Alerts (Downtime)

```bash
# No pup monitors mute/unmute commands.
# Use downtime payloads to silence monitor notifications.
pup downtime create --file downtime.json
pup downtime cancel <downtime_id>
```

## Monitor Creation Best Practices

### 1. Avoid Alert Fatigue

| Rule | Why |
|------|-----|
| **No flapping alerts** | Use `last_Xm` not `last_1m` |
| **Meaningful thresholds** | Based on SLOs, not guesses |
| **Actionable alerts** | If no action needed, don't alert |
| **Include runbook** | `@runbook-url` in message |

```python
# WRONG - will flap constantly
query = "avg(last_1m):avg:system.cpu.user{*} > 50"  # ❌ Too sensitive

# CORRECT - stable alerting
query = "avg(last_5m):avg:system.cpu.user{env:prod} by {host} > 80"  # ✅ Reasonable window
```

### 2. Use Proper Scoping

```python
# WRONG - alerts on everything
query = "avg(last_5m):avg:system.cpu.user{*} > 80"  # ❌ No scope

# CORRECT - scoped to what matters
query = "avg(last_5m):avg:system.cpu.user{env:prod,service:api} by {host} > 80"  # ✅
```

### 3. Set Recovery Thresholds

```python
monitor = {
    "query": "avg(last_5m):avg:system.cpu.user{env:prod} > 80",
    "options": {
        "thresholds": {
            "critical": 80,
            "critical_recovery": 70,  # ✅ Prevents flapping
            "warning": 60,
            "warning_recovery": 50
        }
    }
}
```

### 4. Include Context in Messages

```python
message = """
## High CPU Alert

Host: {{host.name}}
Current Value: {{value}}
Threshold: {{threshold}}

### Runbook
1. Check top processes: `ssh {{host.name}} 'top -bn1 | head -20'`
2. Check recent deploys
3. Scale if needed

@slack-ops @pagerduty-oncall
"""
```

## NEVER Delete Monitors Directly

Use safe deletion workflow (same as dashboards):

```python
def safe_mark_monitor_for_deletion(monitor_id: str, client) -> bool:
    """Mark monitor instead of deleting."""
    monitor = client.get_monitor(monitor_id)
    name = monitor.get("name", "")
    
    if "[MARKED FOR DELETION]" in name:
        print(f"Already marked: {name}")
        return False
    
    new_name = f"[MARKED FOR DELETION] {name}"
    client.update_monitor(monitor_id, {"name": new_name})
    print(f"✓ Marked: {new_name}")
    return True
```

## Monitor Types

| Type | Use Case |
|------|----------|
| `metric alert` | CPU, memory, custom metrics |
| `query alert` | Complex metric queries |
| `service check` | Agent check status |
| `event alert` | Event stream patterns |
| `log alert` | Log pattern matching |
| `composite` | Combine multiple monitors |
| `apm` | APM metrics |

## Audit Monitors

```bash
# Find monitors without owners
pup monitors list | jq '.[] | select(.tags | contains(["team:"]) | not) | {id, name}'

# Find noisy monitors (high alert count)
pup monitors list | jq 'sort_by(.overall_state_modified) | .[:10] | .[] | {id, name, status: .overall_state}'
```

## Downtime vs Muting

| Use | When |
|-----|------|
| **Downtime** | Any planned silence window |
| **Monitor edit** | Query/threshold behavior changes |

```bash
# Downtime (preferred)
pup downtime create --file downtime.json
```

## Failure Handling

| Problem | Fix |
|---------|-----|
| Alert not firing | Check query returns data, thresholds |
| Too many alerts | Increase window, add recovery threshold |
| No data alerts | Check agent connectivity, metric exists |
| Auth error | `pup auth refresh` |

## References

- [Monitor Types](https://docs.datadoghq.com/monitors/types/)
- [Alerting Best Practices](https://docs.datadoghq.com/monitors/guide/)
- [SLO Monitors](https://docs.datadoghq.com/service_management/service_level_objectives/)

Usage Instructions

Learn how to use this skill with different AI agents.

Generic Instructions

Install the pup CLI, authenticate, then add the skill:

brew tap datadog-labs/pack
brew install datadog-labs/pack/pup
pup auth login

npx skills add datadog-labs/agent-skills --skill dd-monitors --full-depth -y

dd-pup is the base skill the others assume; add it alongside any of them:

npx skills add datadog-labs/agent-skills --skill dd-pup --skill dd-monitors --full-depth -y

Description

Most monitor problems are not "the alert did not fire" — they are alerts that fire constantly and get muted, or alerts scoped to {*} that page someone for a host nobody owns. This official Datadog skill teaches an agent both halves: driving the pup CLI to list, inspect and create monitors, and the judgement to make the monitor worth having.

The alerting standard it enforces

The guidance is opinionated in the way alerting guidance has to be. Evaluation windows use last_5m rather than last_1m, because a one-minute window on CPU is a flap generator. Queries must be scoped by env and service and grouped by host, not left as {*}. Recovery thresholds are treated as mandatory rather than optional — a critical at 80 with a critical_recovery at 70 is what keeps a monitor from oscillating across the line. Notification bodies carry template variables, a runbook and the on-call handles, so the page arrives with the context needed to act on it.

Auditing what already exists

Beyond creation, the skill includes jq recipes for the two audits nobody runs: finding monitors with no team: tag, and ranking monitors by recent state churn to surface the noisiest ones. It also draws the distinction between downtime and monitor edits — planned silence belongs in a downtime window (pup downtime create), not in a threshold change that quietly alters behaviour forever.

A deletion guard

Notably, the skill instructs the agent never to delete a monitor directly. Instead it renames it with a [MARKED FOR DELETION] prefix, so a human confirms the removal. That is the sort of guard rail worth having when an agent is operating alerting configuration.

Covers the full monitor type table (metric, query, service check, event, log, composite, APM) and a failure-handling table mapping symptoms to fixes. Requires the pup CLI, authenticated with pup auth login. MIT-licensed, published by Datadog Labs, and works with Claude Code, Codex CLI, Gemini CLI, Cursor, Windsurf and OpenCode.

Related Skills

Auth0's official agent skill: a router that detects your framework and intent, then loads the right Auth0 guidance for login, MFA, Organizations, tenant audits, debugging or provider migration.

Development

Skill: Redis Search

by Redis, Inc.

New

Redis' own guidance for FT.CREATE schema design, FT.SEARCH / FT.AGGREGATE / FT.HYBRID, HNSW vector similarity and RAG retrieval pipelines.

Development

Skill: Supabase

by Supabase

New

Supabase's official skill covering Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron and Queues — with a hard rule to verify against the live changelog before writing code.

Development
New

GreenSock's official ScrollTrigger skill — scroll-linked animation, pinning, scrub and trigger positioning, with the exact start/end syntax agents get wrong.

DevelopmentDesign & Creative
1 views
Browse all skills →