This guide covers the Datadog Agent command-line interface for:
Linux/macOS: datadog-agent
Windows: agent.exeCode language: HTTP (http)
The Datadog Agent CLI is subcommand-based. Datadog’s current Agent command documentation says the general syntax is:
<AGENT_BINARY> <SUB_COMMAND> <OPTIONS>Code language: HTML, XML (xml)
and recommends using:
<AGENT_BINARY> --help
<AGENT_BINARY> <SUB_COMMAND> --helpCode language: HTML, XML (xml)
to see the exact options supported by your installed Agent version. This matters because a few flags can differ between Agent versions and platforms.
1. Quick answer: executable names
| Platform | CLI executable | Typical command |
|---|---|---|
| Linux | datadog-agent | sudo datadog-agent status |
| macOS | datadog-agent | datadog-agent status |
| Windows | agent.exe | agent.exe status |
On Windows, Datadog documents that the main executable name is agent.exe, and commands should be run from an elevated PowerShell or Command Prompt using <PATH_TO_AGENT.EXE> <COMMAND>.
2. Common executable locations
Linux
Common command:
sudo datadog-agent status
Common binary/symlink locations:
/usr/bin/datadog-agent
/opt/datadog-agent/bin/agent/agent
Useful check:
which datadog-agent
Linux Agent service commands are usually managed through systemctl. Datadog’s Linux documentation lists sudo systemctl start|stop|restart|status datadog-agent, plus sudo datadog-agent status, sudo datadog-agent flare, and sudo datadog-agent --help.
macOS
Common command:
datadog-agent status
Common paths:
/usr/local/bin/datadog-agent
/opt/datadog-agent/bin/agent/agent
Datadog’s macOS documentation says the Agent is installed under /opt/datadog-agent by default, and lists commands such as datadog-agent status, datadog-agent flare, datadog-agent --help, and datadog-agent check <CHECK_NAME>.
Windows
PowerShell:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
Command Prompt:
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
Common path:
C:\Program Files\Datadog\Datadog Agent\bin\agent.exeCode language: CSS (css)
Datadog’s Windows docs show the same path and examples for status, launch-gui, and flare.
3. Configuration file locations
Before learning CLI commands, students should know where the Agent reads configuration from.
| Platform | Main config file |
|---|---|
| Linux | /etc/datadog-agent/datadog.yaml |
| macOS | ~/.datadog-agent/datadog.yaml in the generic config docs; macOS platform docs also describe /opt/datadog-agent as the default install location |
| Windows | %ProgramData%\Datadog\datadog.yaml |
Integration configs live under conf.d. For Linux this is /etc/datadog-agent/conf.d/, and for Windows it is %ProgramData%\Datadog\conf.d. Datadog also notes that each integration usually has a <CHECK_NAME>.d/conf.yaml file, and conf.yaml.example can be renamed to conf.yaml to enable that check.
4. Agent service control vs Agent CLI
Do not confuse these two:
Service management
Used to start/stop/restart the Agent process.
Examples:
sudo systemctl restart datadog-agent
Restart-Service DatadogAgent
Agent CLI
Used to inspect, test, troubleshoot, diagnose, or collect support data.
Examples:
sudo datadog-agent status
sudo datadog-agent configcheck
sudo datadog-agent check apache
sudo datadog-agent flare
Mental model:
systemctl / launchctl / Windows Service Manager
= control the Agent service
datadog-agent / agent.exe
= ask the Agent questions or run diagnostics
5. Linux service commands
Start Agent
sudo systemctl start datadog-agent
Use when:
Agent is installed but not running.
Stop Agent
sudo systemctl stop datadog-agent
Use when:
You need to temporarily stop metric/log/trace collection.
Restart Agent
sudo systemctl restart datadog-agent
Use after editing:
/etc/datadog-agent/datadog.yaml
/etc/datadog-agent/conf.d/<integration>.d/conf.yamlCode language: HTML, XML (xml)
Check service status
sudo systemctl status datadog-agent
Use when:
You want to confirm the Linux service is running.
Datadog’s Linux docs also note that older upstart-based systems such as CentOS/RHEL 6 or SUSE 11 use older service-style commands instead of systemctl.
6. macOS service commands
Start Agent
launchctl start com.datadoghq.agentCode language: CSS (css)
Stop Agent
launchctl stop com.datadoghq.agentCode language: CSS (css)
Restart Agent
launchctl stop com.datadoghq.agent
launchctl start com.datadoghq.agentCode language: CSS (css)
Check service status
launchctl list com.datadoghq.agentCode language: CSS (css)
Datadog’s macOS docs list these launchctl commands and also mention that the systray app can be used.
7. Windows service commands
Datadog’s Windows docs say the Agent execution is controlled by the Windows Service Control Manager, and the service is named DatadogAgent.
PowerShell
Get-Service DatadogAgent
Start-Service DatadogAgent
Stop-Service DatadogAgent
Restart-Service DatadogAgent
Command Prompt
sc query DatadogAgent
net start DatadogAgent
net stop DatadogAgent
Datadog Agent CLI service commands
Datadog also documents Windows-only Agent CLI service commands:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" start-service
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" restart-service
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" stopserviceCode language: JavaScript (javascript)
Note the spelling:
stopservice
not:
stop-service
Datadog’s Windows command list includes restart-service, start-service, and stopservice.
8. Officially documented Agent CLI subcommands
Datadog’s Agent Commands page lists these subcommands:
check
config
configcheck
diagnose
flare
health
help
hostname
import
jmx
launch-gui
restart-service
start-service
stream-logs
stopservice
versionCode language: JavaScript (javascript)
Windows docs additionally list:
run
start
status
with start marked as being deprecated but still accepted, and run preferred.
9. CLI syntax by platform
Linux
sudo datadog-agent <subcommand> [options]Code language: HTML, XML (xml)
Example:
sudo datadog-agent status
For checks, Datadog recommends running as the dd-agent user:
sudo -u dd-agent -- datadog-agent check <CHECK_NAME>Code language: HTML, XML (xml)
Datadog’s Agent check troubleshooting docs show sudo -u dd-agent datadog-agent check <CHECK_NAME> and mention --check-rate when rate metrics should be included.
macOS
datadog-agent <subcommand> [options]Code language: HTML, XML (xml)
Example:
datadog-agent status
Windows PowerShell
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" <command> [options]Code language: HTML, XML (xml)
Example:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
Windows Command Prompt
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" <command> [options]Code language: CSS (css)
Example:
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
10. status
Purpose
Shows the current status of the running Agent and enabled integrations.
Use this when:
You want to confirm the Agent is healthy.
You want to see which checks are running.
You want to see integration errors.
You want to verify logs/APM/process/network components.
Datadog’s Agent Commands page says status displays the status of the Datadog Agent and enabled integrations, and a properly configured integration appears under Running Checks with no warnings or errors.
Linux
sudo datadog-agent status
macOS
datadog-agent status
Windows PowerShell
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
Windows Command Prompt
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" statusCode language: JavaScript (javascript)
Useful options
The current Agent source for status documents these options:
| Option | Meaning |
|---|---|
status [section] | Show only a specific status section |
--list, -l | List available status sections |
--json, -j | Print raw JSON |
--pretty-json, -p | Pretty-print JSON |
--file, -o | Write status output to file |
--verbose, -v | Print verbose status |
The source package implements status [section], says --list lists available status sections, and defines flags such as --json, --pretty-json, --file, --verbose, and --list.
Examples
Show full Agent status
sudo datadog-agent status
List status sections
sudo datadog-agent status --listCode language: PHP (php)
Show collector section only
sudo datadog-agent status collector
Save status to a file
sudo datadog-agent status --file /tmp/datadog-agent-status.txt
Output JSON
sudo datadog-agent status --json
Pretty JSON
sudo datadog-agent status --pretty-json
Practical use case
After enabling Apache integration:
sudo systemctl restart datadog-agent
sudo datadog-agent status
Look for:
Running Checks
==============
apache
If the check appears under errors/warnings, use:
sudo datadog-agent check apache
sudo datadog-agent configcheck
11. check
Purpose
Runs one Agent integration check manually.
Use this when:
You configured an integration and want to test it immediately.
You want to troubleshoot why a check is not collecting metrics.
You want to validate config before waiting for Agent collection interval.
Datadog’s troubleshooting guide says to use datadog-agent check <CHECK_NAME> to get more troubleshooting information for an Agent check. It also says to replace <CHECK_NAME> with the check name, for example activemq, ceph, or elastic.
Syntax
Linux:
sudo -u dd-agent -- datadog-agent check <CHECK_NAME>Code language: HTML, XML (xml)
macOS:
datadog-agent check <CHECK_NAME>Code language: HTML, XML (xml)
Windows PowerShell:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" check <CHECK_NAME>Code language: HTML, XML (xml)
Windows Command Prompt:
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" check <CHECK_NAME>Code language: HTML, XML (xml)
Common option
| Option | Purpose |
|---|---|
--check-rate | Include rate metrics in the check output |
Datadog documents --check-rate as an option when rate metrics should be included.
Examples
Test Apache integration
sudo -u dd-agent -- datadog-agent check apache
Test systemd integration
sudo -u dd-agent -- datadog-agent check systemd
Test process integration
sudo -u dd-agent -- datadog-agent check process
Include rate metrics
sudo -u dd-agent -- datadog-agent check apache --check-rate
How to know the check name
The check name usually matches the integration folder:
/etc/datadog-agent/conf.d/apache.d/
So the check name is:
apache
Example:
sudo -u dd-agent -- datadog-agent check apache
Practical use case
You edited:
/etc/datadog-agent/conf.d/apache.d/conf.yaml
Then run:
sudo -u dd-agent -- datadog-agent check apache
If successful, restart Agent:
sudo systemctl restart datadog-agent
Then verify:
sudo datadog-agent status
12. configcheck
Purpose
Prints the configurations loaded and resolved by the running Agent.
Use this when:
You want to confirm which integration config the Agent actually loaded.
You want to verify Autodiscovery config.
You want to troubleshoot wrong YAML, duplicate config, or wrong file path.
You want to see final resolved config after templates/secrets/env vars.Code language: PHP (php)
Datadog’s Agent Commands page describes configcheck as printing all loaded and resolved configurations of a running Agent.
Syntax
Linux:
sudo datadog-agent configcheck
macOS:
datadog-agent configcheck
Windows PowerShell:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" configcheckCode language: JavaScript (javascript)
Examples
Print all loaded configs
sudo datadog-agent configcheck
Search for Apache config
sudo datadog-agent configcheck | grep -A 30 apache
Save configcheck output
sudo datadog-agent configcheck > /tmp/datadog-configcheck.txtCode language: JavaScript (javascript)
Practical use case
You added:
/etc/datadog-agent/conf.d/apache.d/conf.yaml
but Apache metrics do not appear. Run:
sudo datadog-agent configcheck
If Apache is missing, the Agent did not load the config. Check:
File name
YAML indentation
conf.d path
File permissionsCode language: CSS (css)
13. diagnose
Purpose
Runs connectivity and system diagnostics.
Use this when:
The Agent is installed but data is not reaching Datadog.
You suspect proxy, DNS, firewall, TLS, or endpoint connectivity issue.
You want a fast local diagnostic before opening a support case.Code language: JavaScript (javascript)
Datadog lists diagnose as the command that executes connectivity diagnosis on the system.
Syntax
Linux:
sudo datadog-agent diagnose
macOS:
datadog-agent diagnose
Windows PowerShell:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" diagnoseCode language: JavaScript (javascript)
Examples
Run full diagnosis
sudo datadog-agent diagnose
Save output
sudo datadog-agent diagnose > /tmp/datadog-diagnose.txtCode language: JavaScript (javascript)
Practical use case
If Agent status shows API connectivity errors:
sudo datadog-agent status
sudo datadog-agent diagnose
Check:
DNS resolution
Proxy settings
TLS errors
Datadog intake reachability
Site settingCode language: JavaScript (javascript)
14. flare
Purpose
Collects logs, configuration, status, and diagnostic data into a support bundle and can send it to Datadog Support.
Use this when:
Datadog Support asks for a flare.
You need to collect local Agent troubleshooting data.
You have persistent Agent issues.
Datadog’s flare docs say the flare command collects data, can use a support case ID, and asks for the email address associated with the case.
Syntax
Linux:
sudo datadog-agent flare
With support case ID:
sudo datadog-agent flare <CASE_ID>Code language: HTML, XML (xml)
macOS:
datadog-agent flare
datadog-agent flare <CASE_ID>Code language: HTML, XML (xml)
Windows PowerShell:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" flare
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" flare <CASE_ID>Code language: JavaScript (javascript)
Kubernetes examples
Basic Agent pod:
kubectl exec -it <AGENT_POD_NAME> -- agent flare <CASE_ID>Code language: HTML, XML (xml)
Agent container in multi-container pod:
kubectl exec -it <AGENT_POD_NAME> -c agent -- agent flare <CASE_ID>Code language: HTML, XML (xml)
Process Agent container:
kubectl exec -it <AGENT_POD_NAME> -c process-agent -- agent flare <CASE_ID> --localCode language: HTML, XML (xml)
Trace Agent container:
kubectl exec -it <AGENT_POD_NAME> -c trace-agent -- agent flare <CASE_ID> --localCode language: HTML, XML (xml)
Datadog documents these dedicated-container flare commands and notes that system-probe cannot send a flare, so container logs should be collected instead.
Practical use case
Support asks:
Please send an Agent flare for case 123456.Code language: JavaScript (javascript)
Run:
sudo datadog-agent flare 123456
15. health
Purpose
Prints the current Agent health.
Use this when:
You want a quick health check.
You want automation to check whether the Agent internals are healthy.
You do not need the full status output.Code language: JavaScript (javascript)
Datadog’s Agent command list describes health as printing the current Agent health.
Syntax
Linux:
sudo datadog-agent health
macOS:
datadog-agent health
Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" healthCode language: JavaScript (javascript)
Practical use case
Use this in a troubleshooting script:
sudo datadog-agent health || echo "Agent health check failed"Code language: PHP (php)
16. hostname
Purpose
Prints the hostname used by the Agent.
Use this when:
Host is missing in Datadog.
Duplicate hosts appear.
Wrong hostname appears in dashboards.
You want to confirm what hostname the Agent reports.
Datadog’s Agent Commands page describes hostname as printing the hostname used by the Agent.
Syntax
Linux:
sudo datadog-agent hostname
macOS:
datadog-agent hostname
Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" hostnameCode language: JavaScript (javascript)
Practical use case
Your Datadog UI shows host:
ip-10-0-1-25
but you expected:
web-prod-01
Check locally:
sudo datadog-agent hostname
Then review:
hostname:
inside:
/etc/datadog-agent/datadog.yaml
17. version
Purpose
Prints Datadog Agent version information.
Use this when:
You need to confirm Agent version.
You are checking compatibility.
You are troubleshooting support issues.
You want to verify upgrade success.
Datadog’s Agent Commands page lists version as printing version information.
Syntax
Linux:
datadog-agent version
macOS:
datadog-agent version
Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" versionCode language: JavaScript (javascript)
Practical use case
Before and after upgrade:
datadog-agent version
sudo apt-get install datadog-agent
datadog-agent versionCode language: JavaScript (javascript)
18. config
Purpose
Runtime configuration management.
Use this when:
You want to inspect runtime-configurable Agent settings.
You want to temporarily change a runtime setting.
You want to adjust log level without permanently editing datadog.yaml.Code language: CSS (css)
Datadog’s Agent command list describes config as runtime configuration management.
Common examples
List runtime-configurable settings
sudo datadog-agent config list-runtimeCode language: PHP (php)
Get current log level
sudo datadog-agent config get log_levelCode language: JavaScript (javascript)
Temporarily set debug logging
sudo datadog-agent config set log_level debugCode language: JavaScript (javascript)
Restore normal logging
sudo datadog-agent config set log_level infoCode language: JavaScript (javascript)
Important warning
Runtime config changes are generally for troubleshooting and may not persist forever like editing datadog.yaml.
For permanent config, edit:
/etc/datadog-agent/datadog.yaml
then restart:
sudo systemctl restart datadog-agent
19. stream-logs
Purpose
Streams logs being processed by a running Agent.
Use this when:
You enabled log collection but logs are not visible in Datadog.
You want to verify the Agent is tailing a file.
You want to inspect logs before they are sent upstream.
Datadog’s Agent command list describes stream-logs as streaming logs being processed by a running Agent.
Syntax
Linux:
sudo datadog-agent stream-logs
macOS:
datadog-agent stream-logs
Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" stream-logsCode language: JavaScript (javascript)
Practical use case
You configured Apache log collection:
logs:
- type: file
path: /var/log/apache2/access.log
service: apache
source: apacheCode language: JavaScript (javascript)
Then run:
sudo systemctl restart datadog-agent
sudo datadog-agent stream-logs
Generate test traffic:
curl http://localhost/Code language: JavaScript (javascript)
If logs stream locally but do not appear in Datadog, suspect:
Datadog intake connectivity
wrong site
index/exclusion filter
logs pipeline issue
If logs do not stream locally, suspect:
wrong file path
file permissions
logs_enabled not true
bad conf.yaml
Agent not restartedCode language: JavaScript (javascript)
20. launch-gui
Purpose
Starts the Datadog Agent GUI / Agent Manager.
Use this when:
You are on Windows or macOS and want GUI-based Agent inspection.
You want to view status, configure checks, or inspect Agent state.
Datadog’s Windows docs describe the configuration GUI as a browser-based configuration application and show launch-gui examples.
Windows PowerShell
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" launch-guiCode language: JavaScript (javascript)
Windows Command Prompt
"%ProgramFiles%\Datadog\Datadog Agent\bin\agent.exe" launch-guiCode language: JavaScript (javascript)
macOS
datadog-agent launch-gui
21. jmx
Purpose
JMX troubleshooting.
Use this when:
You monitor Java applications.
You configured JMX-based integrations.
You need to troubleshoot JMX bean/metric collection.
Datadog’s command list describes jmx as JMX troubleshooting.
Syntax
sudo datadog-agent jmx --help
Then run the specific subcommand shown by your Agent version.
Practical use case
For Kafka, Cassandra, Tomcat, ActiveMQ, or JVM-based apps:
sudo datadog-agent jmx --help
sudo datadog-agent check kafka
Use JMX troubleshooting when:
JMX port is wrong.
Authentication is wrong.
Bean patterns are wrong.
Metrics are missing.
22. import
Purpose
Imports and converts configuration files from previous Agent versions.
Use this when:
You are migrating older Datadog Agent configuration.
You need to convert legacy Agent config into newer format.
Datadog’s command list describes import as importing and converting configuration files from previous versions of the Agent.
Syntax
datadog-agent import --helpCode language: JavaScript (javascript)
Use this only during migration scenarios. For normal Agent usage, students usually do not need it.
23. help
Purpose
Shows help.
Use this when:
You want to see supported commands.
You want exact flags for your installed Agent version.
Examples
Show global help
datadog-agent --help
Show check help
datadog-agent check --help
Show status help
datadog-agent status --help
Windows
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" --help
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" check --helpCode language: JavaScript (javascript)
Datadog explicitly recommends <AGENT_BINARY> --help to see available subcommands and <AGENT_BINARY> check --help to inspect the options for a specific subcommand.
24. Windows-only commands
Datadog’s Windows command table lists these Windows service-related commands.
start-service
Starts the Agent service through Windows Service Control Manager.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" start-serviceCode language: JavaScript (javascript)
Use when:
DatadogAgent service is stopped.
restart-service
Restarts the Agent service through Windows Service Control Manager.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" restart-serviceCode language: JavaScript (javascript)
Use after editing:
C:\ProgramData\Datadog\datadog.yaml
C:\ProgramData\Datadog\conf.d\<integration>.d\conf.yamlCode language: CSS (css)
stopservice
Stops the Agent service through Windows Service Control Manager.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" stopserviceCode language: JavaScript (javascript)
Use when:
You need to stop the Agent temporarily.
run
Starts the Agent.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" runCode language: JavaScript (javascript)
Use mostly for manual foreground execution or troubleshooting, not typical production service control.
start
Being deprecated, but accepted. Use run instead.
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" startCode language: JavaScript (javascript)
Datadog’s Windows docs say start is being deprecated but accepted, and run should be used as an alternative.
25. Debug mode workflow
For troubleshooting, a common workflow is:
sudo datadog-agent config set log_level debug
sudo systemctl restart datadog-agent
sudo datadog-agent status
sudo datadog-agent flare
sudo datadog-agent config set log_level info
sudo systemctl restart datadog-agentCode language: JavaScript (javascript)
But be careful: debug logs can be noisy.
Use debug mode when:
Agent is not collecting expected data.
Datadog Support asks for debug-level logs.
You need deeper troubleshooting temporarily.
Do not leave debug mode enabled in production longer than needed.
26. Logs location
Linux
Common Agent log directory:
/var/log/datadog/Code language: JavaScript (javascript)
Common log file:
/var/log/datadog/agent.logCode language: JavaScript (javascript)
Windows
Datadog’s Windows docs state Agent logs are located at:
C:\ProgramData\Datadog\logs\agent.logCode language: CSS (css)
and note that ProgramData is hidden.
macOS
Common log directory:
/var/log/datadog/Code language: JavaScript (javascript)
27. Practical lab: troubleshoot an Apache integration
Scenario
Apache metrics/logs are not visible in Datadog.
Step 1: Check Agent service
Linux:
sudo systemctl status datadog-agent
Step 2: Check Agent status
sudo datadog-agent status
Look for:
Running Checks
apache
Step 3: Check loaded configuration
sudo datadog-agent configcheck
Search for Apache:
sudo datadog-agent configcheck | grep -A 40 apache
Step 4: Run Apache check manually
sudo -u dd-agent -- datadog-agent check apache
Step 5: Stream logs locally
sudo datadog-agent stream-logs
Generate traffic:
curl http://localhost/Code language: JavaScript (javascript)
Step 6: Run diagnosis
sudo datadog-agent diagnose
Step 7: Send flare if needed
sudo datadog-agent flare <CASE_ID>Code language: HTML, XML (xml)
28. Practical lab: troubleshoot wrong hostname
Scenario
Datadog UI shows duplicate or unexpected hostnames.
Commands
sudo datadog-agent hostname
sudo datadog-agent status
sudo datadog-agent configcheck
Check config:
sudo grep -n "hostname" /etc/datadog-agent/datadog.yamlCode language: JavaScript (javascript)
Fix if needed:
hostname: web-prod-01Code language: HTTP (http)
Restart:
sudo systemctl restart datadog-agent
Validate:
sudo datadog-agent hostname
29. Practical lab: troubleshoot logs not appearing
Scenario
Linux/Apache logs are configured but not visible in Datadog.
Step 1: Confirm log collection enabled
sudo grep -n "logs_enabled" /etc/datadog-agent/datadog.yamlCode language: JavaScript (javascript)
Expected:
logs_enabled: trueCode language: JavaScript (javascript)
Step 2: Check integration log config
sudo cat /etc/datadog-agent/conf.d/apache.d/conf.yaml
Example:
logs:
- type: file
path: /var/log/apache2/access.log
source: apache
service: apacheCode language: JavaScript (javascript)
Step 3: Restart Agent
sudo systemctl restart datadog-agent
Step 4: Stream logs
sudo datadog-agent stream-logs
Step 5: Check Agent status
sudo datadog-agent status
Look for log collection sections.
30. Practical lab: collect support data
Scenario
You cannot solve the issue and need Datadog Support.
Commands
sudo datadog-agent status > /tmp/dd-status.txt
sudo datadog-agent configcheck > /tmp/dd-configcheck.txt
sudo datadog-agent diagnose > /tmp/dd-diagnose.txt
sudo datadog-agent flare <CASE_ID>Code language: JavaScript (javascript)
If Kubernetes:
kubectl exec -it <AGENT_POD_NAME> -c agent -- agent status
kubectl exec -it <AGENT_POD_NAME> -c agent -- agent configcheck
kubectl exec -it <AGENT_POD_NAME> -c agent -- agent flare <CASE_ID>Code language: HTML, XML (xml)
31. Complete CLI command reference table
| Command | Linux/macOS example | Windows example | Use case |
|---|---|---|---|
status | sudo datadog-agent status | agent.exe status | Show Agent/integration status |
status --list | sudo datadog-agent status --list | agent.exe status --list | List status sections |
status collector | sudo datadog-agent status collector | agent.exe status collector | Show one status section |
check | sudo -u dd-agent -- datadog-agent check apache | agent.exe check apache | Run one integration check |
check --check-rate | datadog-agent check apache --check-rate | agent.exe check apache --check-rate | Include rate metrics |
configcheck | sudo datadog-agent configcheck | agent.exe configcheck | Show resolved configs |
diagnose | sudo datadog-agent diagnose | agent.exe diagnose | Connectivity/system diagnostics |
flare | sudo datadog-agent flare | agent.exe flare | Support bundle |
health | sudo datadog-agent health | agent.exe health | Quick Agent health |
hostname | sudo datadog-agent hostname | agent.exe hostname | Show reported hostname |
version | datadog-agent version | agent.exe version | Show Agent version |
config | datadog-agent config list-runtime | agent.exe config list-runtime | Runtime config management |
stream-logs | sudo datadog-agent stream-logs | agent.exe stream-logs | View logs processed by Agent |
launch-gui | datadog-agent launch-gui | agent.exe launch-gui | Open GUI/Agent Manager |
jmx | datadog-agent jmx --help | agent.exe jmx --help | JMX troubleshooting |
import | datadog-agent import --help | agent.exe import --help | Legacy config migration |
help | datadog-agent --help | agent.exe --help | CLI help |
start-service | Windows only | agent.exe start-service | Start Windows service |
restart-service | Windows only | agent.exe restart-service | Restart Windows service |
stopservice | Windows only | agent.exe stopservice | Stop Windows service |
run | Mainly Windows documented | agent.exe run | Run/start Agent |
start | Deprecated Windows alias | agent.exe start | Deprecated; use run |
32. Student cheat sheet
Linux
sudo systemctl status datadog-agent
sudo systemctl restart datadog-agent
sudo datadog-agent status
sudo datadog-agent configcheck
sudo -u dd-agent -- datadog-agent check <CHECK_NAME>
sudo datadog-agent diagnose
sudo datadog-agent flare
sudo datadog-agent health
sudo datadog-agent hostname
datadog-agent versionCode language: HTML, XML (xml)
macOS
launchctl list com.datadoghq.agent
launchctl stop com.datadoghq.agent
launchctl start com.datadoghq.agent
datadog-agent status
datadog-agent configcheck
datadog-agent check <CHECK_NAME>
datadog-agent diagnose
datadog-agent flare
datadog-agent health
datadog-agent hostname
datadog-agent versionCode language: CSS (css)
Windows PowerShell
$Agent = "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe"
& $Agent status
& $Agent configcheck
& $Agent check <CHECK_NAME>
& $Agent diagnose
& $Agent flare
& $Agent health
& $Agent hostname
& $Agent version
& $Agent launch-gui
& $Agent restart-serviceCode language: PHP (php)
33. Best command order for troubleshooting
Use this order. It saves a lot of time.
1. Is the service running?
2. What does Agent status show?
3. Is my config loaded?
4. Does the check work manually?
5. Are logs being processed?
6. Can the Agent reach Datadog?
7. What hostname is being reported?
8. Collect flare if still unresolved.
Linux command flow:
sudo systemctl status datadog-agent
sudo datadog-agent status
sudo datadog-agent configcheck
sudo -u dd-agent -- datadog-agent check <CHECK_NAME>
sudo datadog-agent stream-logs
sudo datadog-agent diagnose
sudo datadog-agent hostname
sudo datadog-agent flareCode language: HTML, XML (xml)
34. Important note about “all options”
Datadog’s official docs intentionally point users to:
datadog-agent --help
datadog-agent <subcommand> --helpCode language: HTML, XML (xml)
because the exact flags can vary by:
Agent version
Operating system
Agent 6 vs Agent 7
package type
container vs host install
enabled components
experimental features
So the safest teaching rule for students is:
datadog-agent --help
datadog-agent status --help
datadog-agent check --help
datadog-agent flare --help
datadog-agent config --help
Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" --help
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" status --help
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" check --helpCode language: JavaScript (javascript)
That is not a workaround; it is the officially recommended way to inspect version-specific CLI options.
35. Final mental model
Remember this:
status = What is the Agent doing?
configcheck = What config did the Agent load?
check = Can this integration run successfully?
diagnose = Can the Agent connect properly?
flare = Collect support bundle.
health = Is the Agent internally healthy?
hostname = What host identity is Datadog using?
stream-logs = Are logs being processed locally?
version = What Agent version is installed?
config = Runtime config management.Code language: JavaScript (javascript)
For day-to-day DevOps work, the most important commands are:
sudo datadog-agent status
sudo datadog-agent configcheck
sudo -u dd-agent -- datadog-agent check <CHECK_NAME>
sudo datadog-agent diagnose
sudo datadog-agent flareCode language: HTML, XML (xml)
For Windows:
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" status
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" configcheck
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" check <CHECK_NAME>
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" diagnose
& "$env:ProgramFiles\Datadog\Datadog Agent\bin\agent.exe" flareCode language: JavaScript (javascript)
This is the practical CLI toolkit every Datadog student/admin should know.
old content
| Commands | Descriptions |
|---|---|
| datadog-agent check | Run the specified check |
| datadog-agent completion | Generate the autocompletion script for the specified shell |
| datadog-agent config | Print the runtime configuration of a running agent |
| datadog-agent configcheck | Print all configurations loaded & resolved of a running agent |
| datadog-agent diagnose | Check availability of cloud provider and container metadata endpoints |
| datadog-agent dogstatsd-capture | Start a dogstatsd UDS traffic capture |
| datadog-agent dogstatsd-replay | Replay dogstatsd traffic |
| datadog-agent dogstatsd-stats | Print basic statistics on the metrics processed by dogstatsd |
| datadog-agent flare | Collect a flare and send it to Datadog |
| datadog-agent health | Print the current agent health |
| datadog-agent help | Help about any command |
| datadog-agent hostname | Print the hostname used by the Agent |
| datadog-agent import | Import and convert configuration files from previous versions of the Agent |
| datadog-agent integration | Datadog integration manager |
| datadog-agent jmx | Run troubleshooting commands on JMXFetch integrations |
| datadog-agent launch-gui | starts the Datadog Agent GUI |
| datadog-agent run | Run the Agent |
| datadog-agent secret | Print information about decrypted secrets in configuration. |
| datadog-agent secret-helper | Secret management provider helper |
| datadog-agent snmp | Snmp tools |
| datadog-agent status | Print the current status |
| datadog-agent stop | Stops a running Agent |
| datadog-agent stream-logs | Stream the logs being processed by a running agent |
| datadog-agent tagger-list | Print the tagger content of a running agent |
| datadog-agent version | Print the version info |
| workload-list | Print the workload content of a running agent |
datadog-agent check
A Datadog Agent check is a plugin that collects data from a specific source and sends it to the Datadog Agent. These checks can be customized and configured to monitor various metrics and events related to your infrastructure and applications.
datadog-agent completion
The datadog-agent completion command is used to generate shell completion scripts for the Datadog Agent command-line interface (CLI).
Shell completion allows you to save time and avoid typing errors by automatically completing command options, flags, and arguments as you type. When you run the datadog-agent completion command, it will output the completion script in the shell format that you specify as an argument, such as Bash, Zsh, or Fish.
Here are some use cases for the datadog-agent completion command:
- Completing commands and options: When you are working with the Datadog Agent CLI, you may find it time-consuming to type out all of the command options and flags. By using shell completion, you can quickly complete the options and flags as you type, saving time and reducing errors.
- Improving productivity: Shell completion can help you be more productive by completing commands and options quickly and accurately. You don’t have to remember all of the available options and flags, which can be especially helpful when you are using the CLI infrequently.
- Learning the Datadog Agent CLI: If you are new to the Datadog Agent CLI, using shell completion can help you learn the available options and flags more quickly. As you type, you can see the available options and flags, which can help you understand the capabilities of the CLI.
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at Cotocus. I share tech blog at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow , and SEO strategies at Wizbrand.
Do you want to learn Quantum Computing?
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at WIZBRAND
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals
The article serves as a useful command reference, but an important aspect that could be explored further is how these commands are leveraged in large-scale operational environments. In practice, teams often automate commands such as
status,health,configcheck, andflarewithin runbooks, self-healing workflows, and CI/CD validation stages to identify observability issues before they affect production. It would also be beneficial to discuss strategies for handling Agent upgrades, monitoring configuration drift, and standardizing troubleshooting procedures across distributed teams to maintain consistent visibility as infrastructure grows in complexity.