CLI Reference - fleXRPL/datadog-monitor-deployer GitHub Wiki
This document provides detailed information about using the DataDog Monitor Deployer command-line interface.
The dd-monitor
command provides several operations for managing DataDog monitors:
dd-monitor [command] [options] [arguments]
Option | Description |
---|---|
--version |
Show version information |
--help |
Show help message |
--debug |
Enable debug logging |
--quiet |
Suppress output except errors |
--format |
Output format (json, yaml, text) |
Deploy monitors from configuration file(s).
dd-monitor deploy [options] <config-file>...
Option | Description |
---|---|
--dry-run |
Validate without deploying |
--force |
Force update existing monitors |
--parallel |
Number of parallel deployments |
--timeout |
Deployment timeout in seconds |
# Deploy single configuration
dd-monitor deploy monitors/cpu.yaml
# Deploy multiple configurations
dd-monitor deploy monitors/*.yaml
# Dry run deployment
dd-monitor deploy --dry-run monitors/cpu.yaml
# Force update
dd-monitor deploy --force monitors/cpu.yaml
Validate monitor configuration file(s).
dd-monitor validate [options] <config-file>...
Option | Description |
---|---|
--schema-only |
Only validate schema |
--query-only |
Only validate queries |
--strict |
Enable strict validation |
# Validate single configuration
dd-monitor validate monitors/cpu.yaml
# Validate multiple configurations
dd-monitor validate monitors/*.yaml
# Schema-only validation
dd-monitor validate --schema-only monitors/cpu.yaml
List existing monitors.
dd-monitor list [options]
Option | Description |
---|---|
--name |
Filter by name |
--tag |
Filter by tag (multiple allowed) |
--type |
Filter by monitor type |
--format |
Output format (table, json, yaml) |
# List all monitors
dd-monitor list
# Filter by name
dd-monitor list --name "CPU"
# Filter by tags
dd-monitor list --tag "env:production" --tag "service:web"
# JSON output
dd-monitor list --format json
Delete monitor(s) by ID.
dd-monitor delete [options] <monitor-id>...
Option | Description |
---|---|
--force |
Skip confirmation |
--dry-run |
Show what would be deleted |
# Delete single monitor
dd-monitor delete 12345
# Delete multiple monitors
dd-monitor delete 12345 67890
# Force delete without confirmation
dd-monitor delete --force 12345
Export existing monitors to configuration file.
dd-monitor export [options] [monitor-id]
Option | Description |
---|---|
--output |
Output file path |
--format |
Output format (yaml, json) |
--include-defaults |
Include default values |
# Export all monitors
dd-monitor export --output monitors.yaml
# Export specific monitor
dd-monitor export 12345 --output cpu.yaml
# Export as JSON
dd-monitor export --format json --output monitors.json
Show differences between configuration and deployed monitors.
dd-monitor diff [options] <config-file>
Option | Description |
---|---|
--format |
Diff format (unified, context) |
--color |
Enable color output |
--ignore-options |
Ignore option differences |
# Show differences
dd-monitor diff monitors/cpu.yaml
# Colored unified diff
dd-monitor diff --format unified --color monitors/cpu.yaml
The CLI respects the following environment variables:
Variable | Description |
---|---|
DD_API_KEY |
DataDog API key |
DD_APP_KEY |
DataDog application key |
DD_SITE |
DataDog site (e.g., "datadoghq.com") |
DD_ENV |
Default environment tag |
The CLI can be configured using a configuration file at ~/.dd-monitor.yaml
:
default_options:
parallel: 4
timeout: 30
format: yaml
environments:
production:
api_key: ${PROD_DD_API_KEY}
app_key: ${PROD_DD_APP_KEY}
staging:
api_key: ${STAGING_DD_API_KEY}
app_key: ${STAGING_DD_APP_KEY}
Code | Description |
---|---|
0 | Success |
1 | General error |
2 | Configuration error |
3 | Validation error |
4 | API error |
5 | Authentication error |
# Validate configuration
dd-monitor validate monitors/*.yaml
# Dry run deployment
dd-monitor deploy --dry-run monitors/*.yaml
# Deploy monitors
dd-monitor deploy monitors/*.yaml
# Show changes
dd-monitor diff monitors/cpu.yaml
# Deploy updates
dd-monitor deploy --force monitors/cpu.yaml
# List monitors with specific tag
dd-monitor list --tag "service:web"
# Export those monitors
dd-monitor export --tag "service:web" --output web-monitors.yaml
# Delete specific monitor
dd-monitor delete 12345