Deploy Dynatrace Dashboards and Alerts with Monaco CLI
A step-by-step guide to version-controlling Dynatrace dashboards, alerting profiles, and management zones using the Monaco CLI, including dry-run validation and rollback strategies.
02 Jul 2025, 11:37 UTC

Problem: Configuration Drift in Dynatrace
Creating dashboards, alerting profiles, and management zones manually in the Dynatrace UI causes drift between environments and leaves no audit trail. Monaco, Dynatrace's official CLI for Monitoring as Code, lets you define these resources in YAML, store them in Git, and deploy them consistently.
Prerequisites
- Dynatrace environment (SaaS or Managed) with network access to its API endpoint.
- API token with
ReadConfigandWriteConfigscopes. Store it in a secret manager or environment variable—never commit it. - Monaco CLI installed on your workstation or CI runner. Verify compatibility with your Dynatrace version (see release notes).
- Git repository for version control.
Project Structure
Organize configurations in a project directory with a manifest.yaml that maps environments to local folders.
manifest.yaml
name: production-monitoring
environments:
- name: prod
url: https://{your-environment-id}.live.dynatrace.com
token: ${DYNATRACE_API_TOKEN}
projects:
dashboards: ./configs/dashboards
alerting-profiles: ./configs/alerts
management-zones: ./configs/zones
Each project folder contains YAML files for individual resources.
Example: Alerting Profile (configs/alerts/high-severity.yaml)
name: High-Severity-Alerts
qualities:
- severity: ERROR
- severity: CRITICAL
- severity: WARNING
Example: Management Zone (configs/zones/frontend.yaml)
name: Frontend-Services
rules:
- type: SERVICE
enabled: true
propagation: SERVICE_TO_PROCESS_GROUP_LIKE
conditions:
- key:
attribute: SERVICE_TAG
comparisonInfo:
type: TAG
operator: TAG_KEY_EQUALS
value:
key: tier
value: frontend
Example: Dashboard (configs/dashboards/overview.yaml)
name: System-Overview
tiles:
- name: CPU Usage
query: builtin:host.cpu.usage
visualization: GRAPH_CHART
- name: Error Rate
query: builtin:service.errors.total.count
visualization: SINGLE_VALUE
Deployment Workflow
- Set the token in your shell (Linux/macOS) or CI secret:
export DYNATRACE_API_TOKEN='dt0c01.xxx' - Run a dry-run to preview changes without modifying the environment:
monaco deploy --dry-runReview the output: it lists resources to be created, updated, or deleted. Confirm counts match your YAML files.
- Deploy when the dry-run looks correct:
monaco deployThe CLI applies changes and reports success or failure per resource.
Validation Checks
- CLI output: Verify
createdandupdatedcounts equal the number of files you intended to change. - UI verification: Log into Dynatrace, open Dashboards, Alerting profiles, and Management zones. Confirm each resource appears with the expected name and configuration.
- State comparison: Export the live configuration and diff against source:
monaco generate --output ./live-state diff -r ./configs ./live-stateNo differences means the deployment matches source exactly.
Recovery and Rollback
If a deployment breaks alerting or removes a management zone that silences notifications:
- Revert the Git commit to the last known good state.
- Run
monaco deployagain to reapply the previous configuration. - If you must remove resources entirely, use
monaco delete --project <project-name>. Caution: Deleting a management zone or alerting profile immediately stops associated notifications. Verify no critical alerts depend on them before deletion.
Limitations
- Monaco covers dashboards, alerting profiles, management zones, and several other types. Advanced entities like SLOs or custom metrics may require newer CLI versions or direct API calls.
- API token must have
ReadConfigandWriteConfig; additional scopes (e.g.,DataFeeds) are needed for some resource types. - Always test in a non-production environment first. The
--dry-runflag is your primary safety net.
Quick Verification Checklist
| Step | Command / Action | Expected Result |
|---|---|---|
| Dry-run | monaco deploy --dry-run | No errors; create/update/delete counts match plan |
| Deploy | monaco deploy | All resources report SUCCESS |
| UI check | Open Dynatrace UI | Resources visible with correct settings |
| State diff | monaco generate + diff | Zero differences |
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.