The NGINX integration allows you to monitor your NGINX server with the Atatus Infrastructure Agent. The agent reads metrics from the stub_status endpoint, or from the NGINX Plus API, and picks up the error and access logs from the same configuration file. Use this integration to:
  • Track request throughput with the total number of client requests.
  • Monitor connections that are accepted, handled, dropped, and active.
  • Observe connections in the reading, writing, and waiting states.
  • Collect NGINX error and access logs.

Setup

The NGINX integration is bundled with the Atatus Infrastructure Agent. The agent polls NGINX over HTTP, so the status endpoint has to be reachable before any metric arrives. Open your NGINX configuration file, usually /etc/nginx/conf.d/default.conf, and check whether the stub_status directive is already present. If it is not, add the following inside the server block:
Test the configuration after you save the file:
Reload NGINX once the test reports syntax is ok and test is successful:
Note the port the server block listens on, because the configuration below needs it.
stub_status comes from the ngx_http_stub_status_module, which the official NGINX packages compile in by default. To confirm, run nginx -V and look for --with-http_stub_status_module in the output.
The agent polls the endpoint from the same host, so you can keep it off the public internet by adding allow 127.0.0.1; and deny all; to the location block.

Configuration

Metrics

Copy the NGINX example configuration file that ships with the agent:
Then add the following configuration to /etc/atatus-infra-agent/conf.d/nginx.d/nginx.yml. The first entry is for open source NGINX and the second is for NGINX Plus:
Check these before you save:
  • The port in hosts must be the port your server block listens on. 8080 is a placeholder, not a default NGINX port.
  • metrics_path is the location you added during setup. Keep /nginx_status unless you named the location something else. For NGINX Plus it is /api instead.
  • Enable only the entry that matches your build. Leave enabled: false on the NGINX Plus entry if you run open source NGINX.
The tags list is optional. Replace the placeholders with your own key and value pairs, or remove the list.

Logs

Logs are configured in the same file as metrics. First, turn on log collection for the agent in /etc/atatus-infra-agent/atatus.yml:
Then add a logs section to /etc/atatus-infra-agent/conf.d/nginx.d/nginx.yml. The two default types pick up the standard NGINX log paths:
If your logs are in a different location, replace the two default types with your own paths:
NGINX Logs Monitoring covers the log options in more detail.

Verify Metrics

You can verify that the status endpoint is reachable by calling it manually:
Replace 8080 with your NGINX port.

Restart the Agent

After configuration, restart the Atatus Infrastructure Agent:

Metrics

These are the metrics the integration collects from the stub_status endpoint: