NGINX and NGINX Plus Monitoring

Monitor the performance of your NGINX and NGINX Plus web servers with Site24x7's ready-to-install NGINX monitoring plugin integrations. Gain visibility into your NGINX web servers' availability, performance, and usage stats to ensure a seamless experience for your customers.

Add your first server monitoring plugin for free and each subsequent plugin is just $1 per month.

Start 30-day free trial Try now, sign up in 30 seconds
NGINX Monitoring

What are NGINX and NGINX Plus?

NGINX is a widely used open-source, lightweight, and high-performance web server that is also used as a reverse proxy, HTTP cache, and load balancer. It was originally written to solve the C10K problem and works on an event-driven asynchronous architecture. NGINX handles requests by running multiple worker processes using threads, each capable of simultaneously running multiple connections. This enables it to process thousands of concurrent requests.

NGINX Plus is a cloud-native, commercially distributed version that combines the capabilities of NGINX Open Source with enterprise-grade features like high availability, active health checks, DNS system discovery, session persistence, and a RESTful API.

Why is NGINX monitoring important?

In addition to being used as a web server, NGINX is often leveraged as a load balancer, reverse proxy, and HTTP cache. Also, due to its highly scalable nature, multiple critical web services often run on it. End users expect a seamless web experience, and it is vital for businesses to provide them with high-performing web applications with little to no downtime. Monitoring NGINX helps admins get insights into the health and performance of NGINX web servers as well as their underlying web infrastructure so they can troubleshoot issues before any start affecting end users.

Monitor NGINX web server performance with Site24x7

Ensure availability and health of your NGINX servers with our NGINX monitoring tool, which helps you identify issues and bottlenecks. Site24x7 supports both open-source NGINX and its enterprise-grade NGINX Plus version through our plugin integrations.

NGINX performance data icon

Get insights on critical NGINX performance data

Leverage key metrics, including requests per second and active connections, and ensure high availability and optimal performance of your web applications running on NGINX servers.

Anticipate issues with instant alerts icon

Anticipate issues with instant alerts

Get instant notifications every time values cross pre-defined threshold limits and swiftly take preventive or recovery measures.

NGINX logs icon

Derive actionable insights with NGINX logs

Compare and analyze incoming NGINX log data and troubleshoot issues faster with an automatic Site24x7 AppLogs integration.

custom dashboards icon

Create custom dashboards

Assemble data from different parts of your infrastructure with drag-and-drop widgets and build personalized dashboard views.

Start 30-day free trial Try now, sign up in 30 seconds

Get started with Site24x7's NGINX and NGINX Plus monitoring tool

  • Supported Platforms:
  • Python Version:
    2.7 & above
  • Linux Agent Version:
    15.0.0 & above

Key performance metrics

NGINX monitoring helps you to stay ahead of issues occuring within NGINX as well as anywhere else in your web infrastructure.

You can track the following metrics with the NGINX monitoring plugin integration:

Name Description
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.
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.
Connections dropped The connection_dropped is the count of dropped connections. Generally, connections are dropped when a resource limit has been reached.

You can track the following metrics with the NGINX Plus monitoring plugin integration:

Name Description
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.

Setup

Prerequisites

  • Download and install the Site24x7 server monitoring agent (Linux | Windows) in the network or on the specific host where the NGINX instance is running.
  • Enable the nginx_status module to get metrics.
    To enable it, follow the below steps:
    • Open terminal and run the following command to open the NGINX server configuration file:
      $sudo vi /etc/nginx/nginx.conf
    • Add the following code inside the server block which is present in the /etc/nginx/nginx.conf file:
      location /nginx_status {
      stub_status;
      }
    • Save and close the /etc/nginx/nginx.conf file.
    • Restart the NGINX service to apply the changes:
      sudo systemctl reload nginx
    • Test the NGINX status URL that returns the response mentioned below without an error.
      For example, use the below command to test it:
      curl http://localhost/nginx_status
      The response of the command should be similar to the below output.
      Active connections: 2
      server accepts handled requests
      344014 344014 661581
      Reading: 0 Writing: 1 Waiting: 1
    Note: The NGINX status URL used above is the default status URL. If you have assigned a domain, use it in the URL accordingly.
  • Download and install the Site24x7 server monitoring agent (Linux | Windows) in the network or on the specific host where the NGINX instance is running.
  • Enable the nginx_status module to get metrics.
    To enable it, follow the below steps:
    • Open terminal and run the following command to open the NGINX server configuration file:
      $sudo vi /etc/nginx/nginx.conf
    • Add the following code inside the server block which is present in the /etc/nginx/nginx.conf file:
      location /api/ {
      api write=on;
      }
    • Save and close the /etc/nginx/nginx.conf file.
    • Restart the NGINX service to apply the changes:
      sudo systemctl reload nginx
    • Test the NGINX status URL that returns the response mentioned below without an error.
      For example, use the below command to test it:
      curl http://localhost:80/api/3
      The response of the command should be similar to the below output.
      ["nginx","processes","connections","slabs","http","ssl"]
    Note: The NGINX status URL used above is the default status URL. If you have assigned a domain, use it in the URL accordingly.

Installation

  • Create a folder named nginx.
  • Download the nginx.py and the nginx.cfg files from our GitHub repository and place them in the nginx folder.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginx/nginx.py && sed -i "1s|^.*|#! $(which python3)|" nginx.py
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginx/nginx.cfg
  • To verify if the plugin is working, execute the command below with appropriate arguments to check for a valid JSON output with applicable metrics and their corresponding value:
    python3 nginx.py --nginx_status_url=<nginx stats url> --username=<nginx username> --password=<nginx password>
  • Add the applicable configurations in the nginx.cfg file. You can also analyze the metrics with logs with an automatic AppLogs integration.
    [nginx]
    plugin_version=1
    heartbeat=true
    nginx_status_url="http://localhost/nginx_status"
    username=None
    password=None
    timeout=60
    logs_enabled = "true"
    log_type_name = "Nginx Logs"
    log_file_path = "/var/log/nginx/access*"
  • Follow the steps in this article to learn how to run the Python script on a Windows server. You don't need to do this for Linux.
  • Move the nginx folder to the Site24x7 server monitoring plugins directory.

    For Linux: /opt/site24x7/monagent/plugins/

    For Windows: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\plugins\

The agent will automatically execute the plugin within five minutes and display performance data in Site24x7.
To view the plugin monitor and associated performance charts:
  • Log in to Site24x7.
  • Navigate to Plugins and click the required monitor.
  • Create a folder named nginxplus.
  • Download the nginxplus.py and the nginxplus.cfg files from our GitHub repository and place them in the nginxplus folder.
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginxplus/nginxplus.py
    wget https://raw.githubusercontent.com/site24x7/plugins/master/nginxplus/nginxplus.cfg
  • To verify if the plugin is working, execute the command below with appropriate arguments to check for a valid JSON output with applicable metrics and their corresponding value:
    python3 nginxplus.py --nginx_status_url="http://localhost:80/api/3" --username=<nginxplus username> --password=<nginxplus password>
  • Add the applicable configurations in the nginxplus.cfg file.
    [nginxplus]
    nginx_status_url="http://localhost:80/api/3"
    username=<username>
    password=<password>
    logs_enabled="False"
    log_type_name =None
    log_file_path=None
  • Follow the steps in this article to learn how to run the Python script on a Windows server. You don't need to do this for Linux.
  • Move the nginxplus folder to the Site24x7 server monitoring plugins directory.

    For Linux: /opt/site24x7/monagent/plugins/

    For Windows: C:\Program Files (x86)\Site24x7\WinAgent\monitoring\plugins\

The agent will automatically execute the plugin within five minutes and display performance data in Site24x7.
To view the plugin monitor and associated performance charts:
  • Log in to Site24x7.
  • Navigate to Plugins and click the required monitor.

Plugin Contribution

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

  • Supported Platforms:
  • Python Version: 2.7 & above
  • Linux Agent Version:15.0.0 & above

Over 13,000 actively paying customers trust Site24x7

Brand logos of our various customers

Complement NGINX monitoring with 100+ plugins, or build your own.

Choose from our list of more than 100 ready-to-use plugins and monitor your full stack of applications across web servers, databases, load balancers, and more.

See all plugin integrations
Start 30-day free trial Try now, sign up in 30 seconds

FAQs on NGINX and NGINX Plus monitoring

NGINX is an open-source web server with basic functionalities like load balancing and caching. NGINX Plus is its commercial version, offering advanced features such as extended load balancing algorithms, enhanced monitoring, API-driven configuration, active health checks, and professional support. NGINX Plus provides enterprise-grade solutions for high-traffic, complex environments, surpassing the capabilities of the open-source NGINX.

To check NGINX status using command line, use the command systemctl status nginx on Linux systems with systemd. Alternatively, you can use service nginx status for init-based systems. This provides information on NGINX's operational status, including whether it's running, its uptime, and any recent log entries, aiding in troubleshooting or monitoring.

To access the NGINX status page via browser:

  • Ensure it's configured in nginx.conf.
  • Access it at http://localhost/nginx_status or the designated address.