Skip to content

srgfrancisco/ddogctl

Repository files navigation

ddogctl

A modern CLI for the Datadog API. Like Dogshell, but better.

Features

  • Rich terminal output with tables, colors, and progress bars
  • APM trace search and service listing
  • Log querying with trace correlation
  • Database monitoring (DBM) for slow queries and execution plans
  • Investigation workflows that correlate across monitors, traces, logs, and hosts
  • Retry logic with exponential backoff
  • Region shortcuts (us, eu, us3, us5, ap1, gov)

ddogctl vs Dogshell

Feature ddogctl Dogshell
Rich terminal output Yes No
APM traces Yes No
Log search + correlation Yes No
Database monitoring Yes No
Investigation workflows Yes No
Retry with backoff Yes No
Active maintenance Yes Deprecated

Installation

pip install ddogctl

Or with pipx:

pipx install ddogctl

Or with uv:

uv pip install ddogctl

Configuration

Set the required environment variables:

export DD_API_KEY="your-api-key"
export DD_APP_KEY="your-app-key"
export DD_SITE="us"  # optional, defaults to datadoghq.com

Region Shortcuts

Shortcut Site
us datadoghq.com
eu datadoghq.eu
us3 us3.datadoghq.com
us5 us5.datadoghq.com
ap1 ap1.datadoghq.com
gov ddog-gov.com

Quick Start

# Monitors
ddogctl monitor list --state Alert
ddogctl monitor get 12345

# Metrics
ddogctl metric query "avg:system.cpu.user{env:prod}" --from 1h
ddogctl metric search "cpu"

# Events
ddogctl event list --from 1d --priority normal
ddogctl event post "Deployment" "v2.1.0 deployed to prod"

# Hosts
ddogctl host list --filter "env:prod"
ddogctl host info web-prod-01

# APM
ddogctl apm services
ddogctl apm traces my-service --from 1h

# Logs
ddogctl logs search "status:error" --service my-api --from 30m
ddogctl logs tail "env:prod" --follow

# Database Monitoring
ddogctl dbm slow-queries --service postgres-prod --from 1h
ddogctl dbm explain "SELECT * FROM users WHERE id = 1"

# Investigation Workflows
ddogctl investigate service my-api --from 1h
ddogctl investigate host web-prod-01 --from 30m

Contributing

See CONTRIBUTING.md for setup instructions and development guidelines.

License

MIT

About

A modern CLI for the Datadog API. Like Dogshell, but better.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors