Using New Relic to Monitor Nginx. This way.

New Relic introduced back in 2013 Plugin CentralWhere New Relic partners, third-party vendors and users can publish plugin agents that collect selected metric data, and users can install and view plugin data as a set of summary metrics, charts and tables on their dashboard Huh.

It allows you to use a single platform to monitor important information about your application stack, tools, interfaces, logins, alerts and other data, and view everything from a single user interface:

now you can imagine nginx web server with load and performance The Nginx Plugin provided by original Nginx. author of, Collect and display key load metrics to track your nginx instance behavior.

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

  • active client connection
  • Idle (keep-alive) client connections
  • Client connection accept/drop rate
  • Average customer requests per second

Installing NewRelic Nginx Plugin on Your Server

Requirements

To use this plugin, you must have the following:

  • ruby
  • bundler For ruby
  • At least one running NGINX instance with the ngx_http_stub_status module: (enabled by default on Nginx package installs)
  • a new relic account

installation and running

  1. Download Nginx Web Server Plugin .tar.gz from nginx.com here,
  2. Unpack the .tar.gz file in the new directory. (eg /usr/src/nrplugins/)
  3. Daud bundle install To install all the necessary prerequisites.
    If that returns “bundle: command not found”, you can fix that by adding the rubygems path to your $PATH variable. use command gem environment to find “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 config/newrelic_plugin.yml.in to file config/newrelic_plugin.yml,
  5. put your new relic license key in it config/newrelic_plugin.yml,
  6. Add a special stub_status location to your nginx configuration file, like so:
    server {
    listen 127.0.0.1:80;
    server_name localhost;
    
    location = /nginx_stub_status {
    stub_status on;
    allow 127.0.0.1;
    deny all;
    }
    }
  7. Daud ./newrelic_nginx_agent.daemon start To start the agent in daemon mode.

By default the plugin name will be “localhost”, change it to config/newrelic_plugin.yml And in the above Nginx config change “server_name” as well.

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

More screenshots from my New Relic account:

nginx new relic plugin

nginx new relic plugin

Leave a Comment