Nginx Metrics with InstrumentalD

Nginx logo

The best way to get Nginx metrics into Instrumental is with InstrumentalD, the fast and reliable server agent created by the Instrumental team. By using InstrumentalD to collect Nginx metrics, you'll get premade Nginx graphs and unlock the full power of our Query Language.

Quick Start

Check out our Installation Instructions for more details. Otherwise, here's the bare minimum to get up and running.

brew install instrumental/instrumentald/instrumentald
echo 'nginx = ["http://localhost:80/status"]' >> instrumentald.toml
instrumentald -c instrumentald.toml -k PROJECT_TOKEN
curl | sudo bash
sudo apt-get install instrumentald
echo 'project_token = "PROJECT_TOKEN"' | sudo tee /etc/instrumentald.toml
echo 'nginx = ["http://localhost:80/status"]' | sudo tee -a /etc/instrumentald.toml
sudo systemctl restart instrumentald
curl | sudo bash
sudo yum install instrumentald
echo 'project_token = "PROJECT_TOKEN"' | sudo tee /etc/instrumentald.toml
echo 'nginx = ["http://localhost:80/status"]' | sudo tee -a /etc/instrumentald.toml
sudo service instrumentald restart

Configuring InstrumentalD

InstrumentalD will collect the metrics below from as many Nginx servers as configured. Here's a basic example of the nginx config:

nginx = ["http://localhost:80/status"]

Everything you need to know about configuring InstrumentalD, including more information about Nginx config, can be found in the InstrumentalD Configuration docs.

Configuring Nginx

Monitoring Nginx with InstrumentalD requires configuring Nginx to use the basic stats module (ngx_http_status_module) when compiled. It's also necessary to add a block similar to the following inside your Nginx server config:

location /status {
  stub_status on;

Metrics Collected

All Nginx metrics collected by InstrumentalD follow this pattern:

The following metrics are collected:
active The current number of active client connections including Waiting connections.
accepts The total number of accepted client connections.
handled The total number of handled connections. Generally, this is the same as accepts unless some resource limits (e.g. worker_connections) have been reached.
requests The total number of client requests.
reading The current number of connections where nginx is reading the request header.
writing The current number of connections where nginx is writing the response back to the client.
waiting The current number of idle client connections waiting for a request.

How many metrics can I expect from InstrumentalD?

InstrumentalD will collect 7 metrics per Nginx server configured, assuming they have different hostnames.

Questions? We can help!