Query and interact with Datadog using the dogshell CLI.
Use this skill when asked to:
If dogshell isn’t installed, set it up via mise:
mise use python
pip install datadog
| Command | Purpose |
|---|---|
dog metric query
|
Query metric timeseries |
dog monitor show <id>
|
View monitor details |
dog monitor show_all
|
List all monitors |
dog dashboard show_all
|
List dashboards |
dog downtime show_all
|
List scheduled downtimes |
dog tag show <host>
|
Show tags for a host |
| Command | Purpose |
|---|---|
dog monitor post
|
Create a new monitor |
dog monitor update <id>
|
Update existing monitor |
dog dashboard post
|
Create a new dashboard |
dog downtime post
|
Schedule a downtime |
dog metric query --start $(date -v-1H +%s) --end $(date +%s) "avg:trace.rack.request.duration{env:production}"
Time range options:
--start $(date -v-1H +%s) --end $(date +%s)
--start $(date -v-1d +%s) --end $(date +%s)
--start $(date -v-7d +%s) --end $(date +%s)
dog monitor show_all
dog monitor show 12345
dog monitor post "metric alert" "avg(last_5m):avg:trace.rack.request.duration{env:production} > 1" --name "High Request Latency" --message "Request latency exceeded 1s"
Rails/Ruby performance metrics:
avg:trace.rack.request.duration{env:production}
- Request duration
avg:trace.active_record.sql.duration{env:production}
- DB query time
sum:trace.rack.request.hits{env:production}.as_count()
- Request count
avg:trace.sidekiq.job.duration{env:production}
- Background job duration
p95:trace.rack.request.duration{env:production}
- 95th percentile latency
Infrastructure:
avg:system.cpu.user{*}
- CPU usage
avg:system.mem.used{*}
- Memory usage
avg:kubernetes.cpu.usage.total{*}
- K8s CPU
avg:kubernetes.memory.usage{*}
- K8s memory
Metrics follow the pattern:
aggregation:metric.name{tags}
Aggregations: avg,
sum,
min,
max,
p50,
p75,
p90,
p95,
p99
Tags filter results:
{env:production,service:api}
or {*} for all.
Use .as_count() or
.as_rate() to change
how counters are displayed.