NGINX and NGINX Plus Monitoring

Expand your current NGINX (open source) monitoring to support additional features provided via NGINX Plus web server (commercial).

Site24x7 Plugin Integrations support both open source NGINX and its commercial variant NGINX Plus. The existing NGINX community version plugin has been expanded to support the advanced live activity monitoring and a lot more features in the enterprise model of NGINX Plus. Use this additional functionality to monitor your NGINX and NGINX Plus web server and stay ahead of issues.

This document details how to configure the NGINX and the NGINX Plus plugins and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of NGINX web servers.

NGINX Performance Monitoring Metrics

NGINX, a HTTP and reverse proxy server, is a free, open source product. NGINX monitoring helps you to stay ahead of issues occuring within NGINX as well as anywhere else in your web infrastructure. Various out-of-the-box metrics that we provide are:

Waiting

An active connection or a keep-alive connection can be in the Waiting state if there is no active request at the moment.

Reading

When a request is received, the connection moves from the waiting state, and the request is counted as Reading. In this state, NGINX server is reading a client request header.

Connections opened

It is the rate of connections opened per second. Monitoring connection_opened is critical to know if your reverse proxy or load balancer is optimally processing the requests in a timely manner.

Requests per second

It is the number of requests received per second. Monitoring request_per_s helps to alert on spikes or a sudden drop in the incoming web traffic.

Connections dropped

The connection_dropped is the count of dropped connections. Generally, connections are dropped when a resource limit has been reached.

Writing

After a request is read, it is counted as Writing. The request remains in the Writing state till a response is returned to the client. So while NGINX is waiting for a response from its upstream systems and operating on the response, the request will be in the Writing state.

NGINX Plus Performance Monitoring Metrics

NGINX Plus, the commercial version of NGINX, reports the basic open source features along with additional metrics. The enterprise version includes advanced activity monitoring and load balancing, in addition to health checks for custom pages and applications. Various metrics provided for NGINX Plus are:

Accepted and Active connections

The number of client connections attempted by NGINX is given as connections_accepted. The currently active connections (connections_active) is the same as the reading and writing states combined in open source NGINX.

Handshakes and Failed Handshakes

Both NGINX and NGINX Plus are used to terminate encrypted SSL connections, thereby reducing the load on internal servers and certificate costs. Metrics handshakes and handshakes_failed help in understanding the web server's SSL termination and gauge the capacity of hardwares or virtual machines.

Responses 1xx, 2xx, 3xx, 4xx, 5xx

The number of responses with HTTP status code types 1xx, 2xx, 3xx, 4xx, and 5xx.

Reused sessions

The metric session_reuses gives the total number of SSL session credentials reused across multiple SSL connections.

Requests/Responses by zone backend servers

The total number of sessions reused (session_reuses) and the total number of requests received by the zone backend servers gives an idea as to how traffic gets distributed between NGINX servers and zones.

Dropped and Idle connections

If a worker fails to obtain a connection for a particular request, then that is listed under connections_dropped. The connections_idle is the same as the waiting state in NGINX, i.e. client connections with zero current requests.

Prerequisites

  • Ensure that the NGINX or the NGINX Plus server is installed and is up and running.
  • Ensure that the STATUS_URL in the config section is entered correctly.
  • Our Linux server monitoring agent should be installed in the network or on the specific host where the NGINX and NGINX Plus servers are running.
  • While adding a plugin, the plugin name and its folder name should be identical.

Plugin Installation

  • Download and install the latest version of the Site24x7 Linux agent in the server where you plan to run the plugin. If it is installed successfully, you will see a Linux server monitor in the Site24x7 Control Panel. This confirms that the agent is able to communicate with our data center.
  • Download the nginx.py or nginxplus.py file from our GitHub repository.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginx/nginx.py
    OR
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginxplus/nginxplus.py
  • By default, the Python path given in the plugin script is #!/usr/bin/python. If you wish to provide an alternate python path, replace the existing one preceded by the shebang character "#!".
  • By default, the plugin will monitor the NGINX or the NGINX Plus instance that is configured on "localhost". Change the value of NGINX_STATUS_URL to change the monitoring configuration. If you have multiple configurations, you can execute them using a single plugin script. Enter the required configuration details in 'nginx.cfg' or 'nginxplus.cfg' found in our GitHub repository.
  • Create a folder with the name 'nginx' or 'nginxplus' under Site24x7 Linux agent plugin directory - /opt/site24x7/monagent/plugins/ and place the 'nginx.py' and nginxplus.py files under their respective folders.
The agent will automatically execute the plugin within five minutes and send performance data to the Site24x7 data center.
Tip

Manually execute the plugin script using the following command and verify its output. For example, for the NGINX plugin:

python nginx.py

View Data in the Site24x7 Web Client

  1. Log in to Site24x7 and go to Server > Plugins > click on the plugin monitor.
  2. You will be able to view the performance charts on the various metrics for your NGINX and NGINX Plus servers.

Plugin Contribution

Feel free to contribute to our existing plugin and come up with suggestions or feedback on our Community.