Using New Relic to Monitor Nginx. Here’s how.

nginx_new_relic_plugin_01

Earlier this year New Relic introduced Plugin Central, where New Relic’s partners, third-party vendors, and users can publish plugin agents that collect selected metric data, and users can install and view the plugin data on their dashboards as a set of summary metrics, charts, and tables. This allows you to use a single platform to monitor critical information about your application stacks, tools, interfaces, logins, alerts, and other data, and view everything from a single user interface: New Relic.

You can now visualize Nginx web server load and performance with this Nginx plugin provided by the original authors of Nginx. Collect and display key load metrics to track your nginx instances behavior.

The Nginx New Relic plugin allows to collect and report various important counters such as:

  • Active client connections
  • Idle (keepalive) client connections
  • Client connections accept/drop rate
  • Average client requests per second

Installing NewRelic Nginx Plugin on your Server

Requirements

To use this plugin, you must have the following:

  • Ruby (>= 1.8.7)
  • bundler for Ruby (https://github.com/carlhuda/bundler)
  • at least one running NGINX instance with ngx_http_stub_status module: http://wiki.nginx.org/HttpStubStatusModule (enabled by default on Nginx package installs)
  • a New Relic account

Installation and running

  1. Download the Nginx web server plugin .tar.gz from Nginx.com here.
  2. Unpack the .tar.gz file in a new directory. (eg. /usr/src/nrplugins/)
  3. Run bundle install to install all needed prerequisites.
    If that returns “bundle: command not found” you can fix adding the rubygems path to your $PATH variable. Use command gem environment to find the “executable directory” and export PATH=$PATH:/var/lib/gems/1.8/bin (replace “/var/lib/gems/1.8/bin” with the executable directory path)
  4. From within the unpacked directory, copy the config/newrelic_plugin.yml.in file to config/newrelic_plugin.yml.
  5. Insert your New Relic license key into config/newrelic_plugin.yml.
  6. Add a special stub_status location to your nginx configuration file, e.g.:
  7. Run ./newrelic_nginx_agent.daemon start to start the agent in daemon mode.

By default the plugin name will be “localhost” change this in the config/newrelic_plugin.yml and also change “server_name” in the Nginx config above to be the same.

More installation and configuration details are included at the end of the README.txt file packaged with the plugin.

More screenshots from my New Relic account:

nginx_new_relic_plugin_02

 

nginx_new_relic_plugin_03

Using New Relic to Monitor Nginx. Here’s how. was last modified: October 27th, 2013 by Hayden James

Using New Relic to Monitor Nginx. Here’s how.

One Response

  1. Thanks.

    alex December 24, 2013 at 3:43 pm #

Leave a Reply