> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tolmo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Datadog monitors

> Create, update, and delete the Datadog monitors Tolmo manages for your organization. Each monitor has the managed-by:tolmo tag. Tolmo keeps the Datadog credentials on the server.

`tolmo monitor` manages the Datadog monitors that Tolmo owns for your organization. Tolmo resolves the Datadog credentials on the server, so the CLI never sees them. Tolmo adds the `managed-by:tolmo` tag to each monitor that it creates. This tag separates these monitors from the monitors that you manage outside Tolmo.

## List managed monitors

`tolmo monitor list` lists the monitors that the selected integration can see. Use `--tag` to show only Tolmo's monitors. Add `--json` to get machine-readable output:

```bash theme={null}
tolmo monitor list --tag managed-by:tolmo --json
```

To inspect one monitor by its Datadog ID, use `monitor get`:

```bash theme={null}
tolmo monitor get 12345 --json
```

You can also filter by `--name`. To paginate, use `--page-size` (up to `1000`) and the zero-based `--page`:

```bash theme={null}
tolmo monitor list --name production --page-size 100 --page 0
```

## Create a monitor

Write a JSON spec in the [Datadog monitor API format](https://docs.datadoghq.com/api/latest/monitors/). You do not need to add the `managed-by:tolmo` tag. Tolmo adds it before it sends the request to Datadog.

Pass the spec as a file path, or pipe it from stdin:

```bash theme={null}
tolmo monitor create -f /tmp/cpu-spec.json
cat spec.json | tolmo monitor create -f -
```

## Update a monitor

Pass the monitor's Datadog ID and a JSON patch file with the fields to change:

```bash theme={null}
tolmo monitor update 12345 -f /tmp/patch.json
```

> [!WARNING]
>
> `tolmo monitor update` and `tolmo monitor delete` return HTTP 403 for any monitor without the `managed-by:tolmo` tag. This rule protects the monitors that you manage outside Tolmo from accidental changes.

## Delete a monitor

Delete a Tolmo-managed monitor by its Datadog ID:

```bash theme={null}
tolmo monitor delete 12345
```

The command returns HTTP 403 for a monitor without the `managed-by:tolmo` tag.

## Multiple Datadog integrations

If you connected more than one Datadog account, select one with `--integration <integration-id>`. `tolmo query list` shows the integration IDs. For example:

```bash theme={null}
tolmo monitor list --integration <integration-id>
```

## Example monitor spec

This minimal spec creates a CPU alert. Change the `query`, `message`, and thresholds for your environment. Then pass the file to `tolmo monitor create`:

```json cpu-monitor.json theme={null}
{
  "name": "High CPU on production hosts",
  "type": "metric alert",
  "query": "avg(last_5m):avg:system.cpu.user{env:prod} > 80",
  "message": "CPU is over 80% on {{host.name}}. @pagerduty",
  "tags": ["env:prod"],
  "options": {
    "thresholds": {
      "critical": 80,
      "warning": 70
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.