Skip to main content
In this lesson we install the Datadog Agent to collect host system metrics (CPU, memory, I/O, network, processes) and then configure the NGINX integration so Datadog can scrape NGINX status metrics (requests, connections, upstreams, etc.).
A Datadog system metrics dashboard showing multiple monitoring charts and widgets (CPU usage, memory breakdown, load averages, disk latency, network traffic, and a processes memory treemap). The dashboard is labeled "Data Dog System Metrics" and appears to be for an nginx instance.
Example NGINX access/error lines you might see in Datadog logs (for reference):
Prerequisites
  • A Datadog account (free trials are typically available): https://www.datadoghq.com
  • Root or sudo access on the host where NGINX runs and where the Datadog Agent will be installed.
  • NGINX built with http_stub_status_module (or NGINX Plus for extended metrics).
Installation — Datadog Agent
  1. Sign in to Datadog and choose your operating system; the UI will present an install command that includes your API key and site (e.g., datadoghq.com or datadoghq.eu).
  2. Important: never share your API key publicly.
Generic install command (replace <YOUR_API_KEY> and <YOUR_SITE> with values from the Datadog UI):
Example for the EU site:
During installation you’ll see repository configuration, GPG key imports, package downloads, and unpacking. A successful install typically shows the datadog-agent package being installed. Example truncated console output:
Verify the Agent is running:
It can take a few minutes for the agent to begin sending metrics and for them to appear in the Datadog UI (Dashboards → Hosts or Dashboards → Metrics). Quick commands reference Enable the NGINX integration in Datadog
  • In the Datadog UI go to Integrations → Integrations and search for “Nginx”.
  • Datadog can auto-detect some services and will suggest integrations when applicable.
A screenshot of the Datadog Integrations page showing autodetected integrations (Nginx, SSH) and a grid of available integration tiles (.NET, 1Password, Active Directory, ActiveMQ, etc.). The left sidebar and top navigation are visible with search and category filters.
Expose NGINX metrics endpoint (stub_status) Datadog scrapes an HTTP endpoint exposed by NGINX. For open-source NGINX, enable stub_status and expose it only on the local interface so the agent can scrape it. Add a local-only server block (example uses port 81):
Notes:
  • If you already have site server blocks for example.com (80/443), add this local server block in the same host config or included file—but do not expose /nginx_status publicly.
  • After editing config, test and reload NGINX:
Verify the stub_status endpoint locally:
Expected stub_status output:
Do not make the NGINX stub_status endpoint publicly accessible. Always restrict it to localhost or trusted networks to avoid exposing internal metrics.
Configure the Datadog NGINX integration
  1. In Datadog: Integrations → NGINX → Configure.
  2. Point the integration to the local endpoint (e.g., localhost:81 or 127.0.0.1:81) so the agent scrapes http://127.0.0.1:81/nginx_status.
  3. If you changed the port or path, update the integration settings accordingly.
Verify the module is available in NGINX:
If the command outputs http_stub_status_module, the module is present. If not, install an NGINX package that includes it or rebuild NGINX with that module. Viewing NGINX metrics in Datadog
  • After integration is configured and the agent is scraping the endpoint, allow a few minutes for metrics to appear.
  • Dashboards → NGINX or Dashboards → Hosts will show NGINX-specific charts (connections, requests, upstream statuses) alongside host-level metrics (CPU, memory, load).
If metrics are not visible immediately, try changing the dashboard time window (e.g., last 15 minutes) and confirm the host is selected in the integration settings.
A screenshot of the Datadog web UI showing an "Organize Dashboards with Lists" banner and a list of dashboards (e.g., NGINX, Host Counts) in the main pane. The page includes a left navigation menu, a search bar, and columns for author/teams/modified/popularity.
Troubleshooting and host details
  • Click an individual host in Datadog to open the host summary and view system metrics and integrations reporting for that host.
  • Confirm the Datadog agent is reporting and that the NGINX integration shows the configured endpoint.
A screenshot of the Datadog "NGINX - Overview" dashboard showing a large green NGINX banner, activity summary widgets (mostly showing no data), and a left-hand navigation menu with monitoring options.
Host map and host detail example:
A Datadog infrastructure Host Map screenshot showing a single host labeled "nginx" visualized as a green hexagon with nested components "agent" and "ntp." The lower panel shows host details and metrics like CPU utilization.
Final tips and recommended next steps
  • Ensure the Datadog Agent is running and that http://127.0.0.1:<PORT>/nginx_status is reachable from the host where the agent runs.
  • Keep /nginx_status restricted to localhost or a trusted IP range; do not expose it publicly.
  • For advanced metrics (status zones, upstream detail, extended metrics), consider NGINX Plus or additional log parsing and instrumentation.
  • Use load testing tools like ApacheBench (ab) or wrk to generate traffic and observe how metrics change in real time.
  • Check agent logs for troubleshooting: /var/log/datadog/ and run sudo datadog-agent status for runtime diagnostics.
If metrics do not appear immediately, wait a few minutes and verify the agent logs (/var/log/datadog/ or sudo datadog-agent status) and the integration configuration (host/port) in the Datadog UI.
This completes the Datadog Agent installation and NGINX integration setup for collecting host and NGINX metrics. For deeper troubleshooting or advanced monitoring (tracing, custom metrics, log processing), review Datadog’s documentation and integration-specific guides. Links and references

Watch Video