dtctl

Your Dynatrace platform, one command away.
A kubectl-inspired CLI for workflows, dashboards, queries, and more.

Release Build Go Report License
macOS / Linux $ brew install dynatrace-oss/tap/dtctl
Windows > irm https://raw.githubusercontent.com/dynatrace-oss/dtctl/main/install.ps1 | iex
dtctl demo showing workflow and dashboard management

Why dtctl?

Familiar CLI Conventions

get, describe, edit, apply, delete — if you know kubectl, you already know dtctl. Predictable verb-noun syntax for both humans and AI agents.

Built for AI Agents

Structured JSON output (--agent), machine-readable command catalog (dtctl commands), and a bundled Agent Skill that teaches AI assistants how to operate Dynatrace.

Multi-Environment

Switch between dev, staging, and production with a single command. Safety levels prevent accidental destructive operations in the wrong environment.

DQL Passthrough

Execute DQL queries directly: dtctl query "fetch logs | limit 10". File-based queries, template variables, and CSV/JSON/YAML export built in.

OAuth & Token Auth

Browser-based SSO login with automatic token refresh, or classic API tokens. Credentials stored securely in your OS keyring.

Pre-Apply Hooks

Run external validators — OPA policies, JSON Schema checks, custom linters — before apply sends resources to the API. Configure globally or per-context. See Configuration.

Watch Mode

Real-time monitoring with --watch for all resources. See additions, modifications, and deletions highlighted as they happen.

Quick Example

# List all workflows
dtctl get workflows

# Run a DQL query
dtctl query "fetch logs | filter status='ERROR' | limit 10"

# Apply configuration from a YAML file with template variables
dtctl apply -f workflow.yaml --set env=prod

# Get dashboards as JSON for automation
dtctl get dashboards -o json

# Execute a workflow and wait for completion
dtctl exec workflow "Daily Health Check" --wait --show-results

# Ask Davis CoPilot a question
dtctl exec copilot nl2dql "error logs from last hour"

Supported Resources

Resource Operations
Workflows get, describe, create, edit, delete, execute, history, diff
Dashboards & Notebooks get, describe, create, edit, delete, share, diff, history, restore
DQL Queries execute, verify, template variables, live mode
SLOs get, create, delete, apply, evaluate
Settings get schemas, get/create/update/delete objects
Buckets get, describe, create, delete
Lookup Tables get, describe, create, delete (CSV auto-detection)
Extensions 2.0 get, describe, apply monitoring configs
Hub Extensions get, describe, list releases, filter by keyword
App Functions get, describe, execute
App Intents get, describe, find, open (deep linking)
Davis AI analyzers, CoPilot chat, NL-to-DQL, document search
Live Debugger breakpoints, workspace filters, snapshot decoding
Azure / GCP connections, monitoring configs

Install

# Homebrew (macOS/Linux)
brew install dynatrace-oss/tap/dtctl
# PowerShell (Windows)
irm https://raw.githubusercontent.com/dynatrace-oss/dtctl/main/install.ps1 | iex
# Binary download
# https://github.com/dynatrace-oss/dtctl/releases/latest

# Build from source
git clone https://github.com/dynatrace-oss/dtctl.git && cd dtctl && make install

Then authenticate and go:

# OAuth login (recommended)
dtctl auth login --context my-env --environment "https://abc12345.apps.dynatrace.com"

# Verify
dtctl doctor

# Start using dtctl
dtctl get workflows
Read the Full Documentation