Loading...
Loading...
Investigate incidents, debug performance issues, analyze logs, and manage observability resources in Dynatrace using the dtctl CLI. Use this skill whenever the user asks about error rates, latency spikes, service health, crash-looping pods, web vitals, SLO status, open problems, root cause analysis, log patterns, trace analysis, or building dashboards — even if they don't mention Dynatrace by name. Also covers DQL queries, workflow management, notebook and dashboard creation, settings configuration, and any operations against a Dynatrace environment.
npx skill4agent add dynatrace-oss/dtctl dtctldtctl# Discover all available commands, flags, and resources
dtctl commands --brief -o json
# Show current context
dtctl config current-context
# Show context details
dtctl config describe-context $(dtctl config current-context) --plain
# Show authenticated user
dtctl auth whoami --plaindtctl querydtctl wait queryreferences/DQL-reference.mddtctl describe <resource> <id> -o json --plain| Resource | Aliases |
|---|---|
| analyzer | analyzers |
| app | apps |
| bucket | bkt |
| copilot-skill | copilot-skills |
| dashboard | dash |
| edgeconnect | ec |
| extension | ext, extensions |
| extension-config | extcfg, extension-configs |
| function | fn, func |
| group | groups |
| intent | intents |
| lookup | lookups, lkup |
| notebook | nb |
| notification | notifications |
| sdk-version | sdk-versions |
| settings | setting |
| settings-schema | schema |
| slo | - |
| slo-template | slo-templates |
| trash | deleted |
| user | users |
| workflow | wf |
| workflow-execution | wfe |
| Verb | Description | Example |
|---|---|---|
| get | List resources | |
| describe | Show resource details | |
| edit | Edit resource interactively | |
| apply | Create/update from file | |
| delete | Delete resource | |
| exec | Execute workflow/function/analyzer/copilot | |
| query | Run DQL query | |
| logs | Print resource logs | |
| wait | Wait for conditions | |
| history | Show document history | |
| restore | Restore document version | |
| share | Share document | |
| unshare | Remove sharing | |
| find | Discover resources | |
| open | Open in browser | |
| diff | Compare resources | |
| verify | Validate without executing | |
| commands | List all commands (machine-readable) | |
# Agent envelope mode (auto-detected in AI environments)
-A, --agent # Structured JSON envelope with ok/result/error/context
--no-agent # Opt out of auto-detected agent mode
# Machine-readable formats (use these for AI agents)
-o json # JSON output
-o yaml # YAML output
-o csv # CSV output
-o chart # ASCII chart (for time series)
-o sparkline # ASCII sparkline (for time series)
-o barchart # ASCII bar chart (for time series)
# Human-readable formats
-o table # Table format (default)
-o wide # Wide table with more columns
# Always use --plain flag for AI consumption (implied by --agent)
--plain # Strips colors and prompts, best for parsingdtctl <command> --agentdtctl <command> -o json --plain--agent{
"ok": true,
"result": [ ... ],
"context": {
"verb": "get", "resource": "workflow",
"total": 5, "has_more": false,
"suggestions": ["Run 'dtctl describe workflow <id>' for details"]
}
}# workflow.yaml
title: "{{.environment}} Deployment"
owner: "{{.team}}"
trigger:
schedule:
cron: "{{.schedule | default "0 0 * * *"}}"# query.dql
fetch logs
| filter host.name == "{{.host}}"
| filter timestamp > now() - {{.timerange | default "1h"}}dtctl apply -f file.yaml --set environment=prod --set team=platform# Copilot skills
dtctl get copilot-skills -o json --plain
# Functions
dtctl get functions -o json --plain
dtctl exec function <id-or-name> --payload '{"key":"value"}' --plain
# Analyzers
dtctl get analyzers -o json --plain
dtctl exec analyzer <id-or-name> --input '{"timeframe":"now-2h"}' --plainget ... -o json --plaindescribeexec# Check current user and permissions
dtctl auth whoami --plain
dtctl auth can-i create workflows
dtctl auth can-i delete dashboardscan-ireferences/DQL-reference.mddtctl query ... -o json --plaindtctl wait query ...# Inline query
dtctl query "fetch logs | filter status='ERROR' | limit 100" -o json --plain
# Query from file with variables
dtctl query -f query.dql --set host=h-123 --set timerange=2h -o json --plain
# Wait for query results
dtctl wait query "fetch spans | filter test_id='test-123'" --for=count=1 --timeout 5m
# Query with chart output
dtctl query "timeseries avg(dt.host.cpu.usage)" -o chart --plaindtctl apply -f dashboard.yaml --plaindtctl get dashboard <id> -o yaml --plainname: "Dashboard Name"
type: dashboard
content:
annotations: []
importedWithCode: false
settings:
defaultTimeframe:
enabled: true
value: { from: now()-2h, to: now() }
layouts:
"1": # string key, must match a tile key
x: 0 # 24-column grid (full=24, half=12, third=8)
"y": 0 # MUST quote "y" to avoid YAML boolean parse
w: 12
h: 6
tiles:
"1":
title: "Tile Title"
type: data # data | markdown
query: |
fetch logs | limit 10
visualization: lineChart
visualizationSettings:
autoSelectVisualization: false
davis: { enabled: false, davisVisualization: { isAvailable: true } }type: dataqueryvisualizationsingleValuelineChartareaChartbarChartpieCharttablehoneycombscatterplottype: markdowncontentdavis.enabled: falsemakeTimeseriestimeseriesversionididdtctl get <resource> -o json --plain | jq -r '.[] | "\(.id) | \(.name)"'dtctl auth can-i <verb> <resource>dtctl config describe-context $(dtctl config current-context) --plaindtctl config use-context <name>dtctl --helpdtctl <command> --help--plainget/describe--mine