npx skills add ...
npx skills add datadog-labs/agent-skills --skill agent-install
npx skills add datadog-labs/agent-skills --skill agent-install
Install the Datadog Agent on Linux hosts via SSH with Single Step Instrumentation (SSI) enabled — SSI automatically instruments applications for APM without code changes. Only use if no agent is installed yet.
Before doing anything else: Fully resolve all variables in
## Context to resolve before acting. Do not begin Step 1 until every variable has a concrete value.
Invoke this skill when the user expresses intent to:
Do NOT invoke this skill if:
datadog-agent status firstdd-apm-k8s-agent-install insteadIf DD_API_KEY is already set — proceed directly to gathering infrastructure info.
If DD_API_KEY is not set — tell the user:
Please run the following in this chat to set your credentials (the
!prefix executes it in this session):
Wait for the user to run the commands, then re-run the check above before continuing.
Only do this phase if the user hasn't already provided the information. If SSH credentials are known, skip to Phase 2.
Ask the user:
verify-ssi.Verify SSH works for each host before proceeding:
If it returns a hostname — proceed. ERROR: Connection refused or timeout — resolve connectivity before continuing.
Once SSH is confirmed, present a plan to the user before proceeding. For example:
Wait for user confirmation before starting installs.
Per host — check before installing:
If architecture is x86_64 or aarch64, and the OS is a supported distribution (Ubuntu 16.04+, Debian 9+, RHEL/CentOS 6-9, Amazon Linux 2/2023, SUSE 12+) — proceed.
ERROR: Architecture is armv7l (32-bit ARM) or unsupported OS — stop. Datadog Agent 7 and SSI do not support this configuration.
| Variable | How to resolve |
|---|---|
DD_API_KEY | Check echo $DD_API_KEY first — if set, use it. Otherwise ask the user for their API key from Datadog UI: Organization Settings → API Keys. Never log or print the key. |
DD_SITE | Check echo $DD_SITE first — if set, use it. Otherwise ask the user. Default: datadoghq.com. Options: datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com |
SSH_KEY | Ask the user for the path to their SSH private key, or check CLAUDE.md |
SSH_USER | Ask the user for the SSH username. Default: root |
SSH_HOST | Ask the user for the hostname or IP of the target host |
SSH_PORT | Ask the user for the SSH port. Default: 22 |
Run for each host that does not already have the agent installed.
DD_APM_INSTRUMENTATION_ENABLED=host causes the install script to also install datadog-apm-inject and language library packages under /opt/datadog-packages/ in one pass.
If the script completes without errors — proceed to Phase 2.
ERROR: curl: command not found:
ERROR: Permission error — ensure the SSH user has sudo access. The install script requires root.
ERROR: Script fails with GPG key error — retry; if it persists, check the host's DNS resolution for keys.datadoghq.com.
Healthy output shows:
Agent (v7.XX.X) with Status: RunningAPI Keys status: API Key ending with XXXX: ValidERROR: command not found — installation did not complete. Re-run Phase 1.
ERROR: API key invalid — update and restart:
ERROR: Agent service not running:
Verify APM inject packages are present on disk (not just registered):
If /opt/datadog-packages/datadog-apm-inject exists — injection is available.
ERROR: Directory missing or empty — datadog-installer status may show the package as registered while its directory is actually empty (stale registration). Reinstall:
Verify hostname registration — the Agent must resolve and register its hostname for the host to appear in Datadog. DNS lookup failures are common in containers and minimal VMs:
If Hostname: <some-name> is shown — hostname resolved. Record this as DD_HOSTNAME for all subsequent steps.
ERROR: Hostname: (none) or any DNS resolution error — the agent can't resolve its own FQDN. Fix by setting the hostname explicitly in datadog.yaml:
SSI only injects into processes at startup. Existing processes keep running uninstrumented until restarted. Discover what's running so the user knows what to restart.
For each application-level listener (ignore sshd, systemd, chronyd):
Present findings to the user:
Do not offer to restart services. Do not restart services unless the user explicitly asks.
Exit when ALL of the following are true:
datadog-agent status shows Running, API key valid)/opt/datadog-packages/datadog-apm-inject exists on disk on each hostAutomatically proceed to enable-ssi (if services need UST labels configured) or verify-ssi (if services have already been restarted) — do not ask the user for permission.
DD_API_KEY in shell history — pass it inline in the SSH command only