NGINX

Note

This plugin is currently being groomed to be an integration. It works, but we haven’t spent a lot of time on it yet to optimize the user experience. Feel free to try it out, just keep in mind that we will be enhancing the experience over time.

Overview

NGINX is an open source web server with a strong focus on high concurrency, performance and low memory usage. It’s one of the most popular web servers on the internet, and can also act as a reverse proxy, a load balancer, or as an HTTP cache.

The Host Agent allows you to easily monitor the health of your NGINX service(s). It requires that your nginx binary is compiled with the stub_status module enabled.

Setup

The nginx plugin is included with the AppOptics host agent by default, please follow the directions below to enable it for a host agent instance.

Prerequisites

The NGINX server being monitored must have the stub_status module compiled into its binary. Most distributions have this enabled by default. This can be verified with the following command:

$ nginx -V 2>&1 | grep -o with-http_stub_status_module

Your NGINX server will need a location defined with the stub_status module activated. Here is a sample definition that allows connections from the local agent and works with our default plugin configuration.

server {
    location /server_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }
}

In addition, you’ll need to adjust the URL setting in the /opt/appoptics/etc/plugins.d/nginx.yaml configuration file to match your particular setup.

The server blocks of the NGINX config are typically in the supplemental configuration files that are referenced by the master config. Locate the master config with:

$ nginx -t

Open the master configuration file, and search for include near the end of the file. Find the server block in one of the referenced config files and modify it as referenced above, then reload NGINX:

$ nginx -s reload

Configuration

The host agent provides an example configuration file to help you get started quickly. It defines the plugin and task file to be loaded by the agent, but requires you to provide the correct settings for your NGINX server. To enable the plugin:

  1. Make a copy of the NGINX example configuration file /opt/appoptics/etc/plugins.d/nginx.yaml.example, renaming it to /opt/appoptics/etc/plugins.d/nginx.yaml:
$ sudo cp /opt/appoptics/etc/plugins.d/nginx.yaml.example /opt/appoptics/etc/plugins.d/nginx.yaml
  1. Update /opt/appoptics/etc/plugins.d/nginx.yaml configuration file with settings specific to your NGINX server, for example:
     collector:
nginx:
all:
urls: |-
    http://localhost/server_status

response_timeout: "5s"

     load:
plugin: snap-plugin-collector-bridge-nginx
task: task-bridge-nginx.yaml
  1. Restart the host agent:
$ sudo service appoptics-snapteld restart
  1. Enable the NGINX plugin in the AppOptics UI

On the Integrations Page you will see the NGINX plugin available if the previous steps were successful. If you do not see the plugin, see Troubleshooting.

Select the NGINX plugin to open the configuration menu in the UI, and enable the plugin.

You should soon see the nginx metrics reported to your dashboard.

You should soon see the nginx metrics reported to your dashboard.

Metrics and Tags

The table below lists each of the metrics collected by the NGINX plugin.

Name Description
nginx.accepts Total number of accepted client connections
nginx.active Number of active client connections including waiting connections
nginx.handled Total number of handled connections
nginx.reading Number of connections where nginx is reading the request header
nginx.requests Total number of client requests
nginx.waiting Number of idle connections waiting for a request
nginx.writing Number of connections where nginx is writing the response to the client

Tags

The table below lists each tag available for the NGINX plugin.

Tag Name Description
hostname Name of the host. Instead of using that tag we recommend using the @host alias.
port Port number
server Name of the server