NGINX Updates New Relic Plugin

andreibelovGuest author Andrei Belov is a staff engineer for Nginx, Inc., a high performance, open source Web application accelerator that helps many of the world’s busiest websites deliver more content, faster. This post was adapted from a post on the Nginx blog. You can see Andrei’s 2013 guest post on New Relic here

We created the first version of the NGINX Web server plugin for New Relic in March of 2013. Since then, we’ve received lots of interest from users. The NGINX Web server plugin continues to be one of the most used plugins, in spite of the few things that we believe could be improved.

In the beginning, we selected Ruby as the base language for the plugin. It was chosen because the New Relic platform itself was written in Ruby, the API was not yet published and many things were changing quickly.

Later, after the launch of the New Relic platform, we continued to work on adding a number of improvements based on users’ feedback and our own vision on how to improve the overall usability of the NGINX monitoring plugin, and realized the need for further changes.

What’s new?

Today, we are pleased to announce a major update of the NGINX plugin for New Relic–version 2.0, which includes the following changes:

  • It is rewritten in Python, no more need to install Ruby.
  • The plugin is finally packaged–we have pre-built packages for RHEL/CentOS and Debian/Ubuntu based systems. An included init script allows for easier set up and autostart of the plugin.
  • Added two more dashboards for NGINX Plus customers: Servers (summary counters for virtual servers that are configured to enable collecting of additional status information via status zone directive) and Cache (cumulative stats for all configured caches).
  • Verbose logging is now available and turned on out of the box.


Please use this link to get the installation instructions and download the NGINX plugin.

Configuring the plugin

The NGINX plugin configuration is located in the /etc/nginx-nr-agent/nginx-nr-agent.ini file. Minimal configuration should include

  • Your New Relic license key (newrelic_license_key parameter in global section).
  • At least one “source” section must present. Section name is used in log only, and may contain almost anything you’d want. Two parameters are required:
  1. name indicates NGINX instance name in New Relic UI
  2. url specifies full URL to the corresponding instance. Plugin supports stub status format from NGINX OSS and new JSON status from NGINX Plus as a source.

Optional http_user and http_pass parameters can be used to set HTTP basic auth credentials in cases when the corresponding location is protected by an auth basic directive.

Default log file is /var/log/nginx-nr-agent.log.

Running the NGINX plugin

The plugin can be managed via init script, i.e. you can use commands such as service nginx-nr-agent start, service nginx-nr-agent status and service nginx-nr-agent stop to start the plugin, get its status and stop it, accordingly.

When started from init script, the plugin daemon runs under the nobody user.

You can start the plugin directly by running /usr/bin/, with the following optional parameters:

  • -c, --config – path to configuration file
  • -p, --pidfile – path to PID file
  • -f, --foreground – do not detach from terminal (useful for debugging)

If everything is working as expected, the plugin tab should appear in your New Relic UI:


Dashboard examples

The Overview dashboard reveals the most important metrics for the whole instance, such as number of active and idle connections, and requests rate:


The Connections dashboard shows detailed charts representing various metrics related to clients’ connections handling:


The Requests dashboard shows two charts, the number of Active requests currently being processed and the overall Request rate:


The Upstreams dashboard (available only with NGINX Plus), has detailed stats about all configured upstream groups:


The Servers dashboard (available only with NGINX Plus), show detailed stats about all configured virtual server zones:


The Cache dashboard, (available only with NGINX Plus), has summary stats for all configured caches:


What’s next?

We plan to extend the plugin’s functionality with additional metrics provided by future enhancements in both NGINX OSS and NGINX Plus. To make sure we get it right, your feedback is very important to us. Please share any ideas, thoughts or questions you have here.

This post was written by a guest contributor. Please see their biographical details at the top of the post above. View posts by .

Interested in writing for New Relic Blog? Send us a pitch!