Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Nginx Last updated: September 6, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Monitoring webserver is essential to see what’s happening on your website. Lately, I was looking for some sort of solution and came across ngxtop, which helps you to monitor various metrics, including the following.

In this article, I’ll explain how to install and use ngxtop for Linux and Ubuntu OS.

Previously, I have used GoAccess Log Analyzer and found ngxtop is a lightweight and good choice for Nginx web server metrics monitoring.

This assumes you have Nginx installed and running. If not, then you can refer to my installation guide.

A little introduction about ngxtop

ngxtop is a python based program, which you can install on top of Python. Once installed, you can execute ngxtop, and you will notice it looks like the typical top output on Linux but with Nginx related information.

To Install ngxtop on CentOS/RHEL

First, you need to install PIP (Python Package Management System).

To do so…

  • Login to your server with root credential
  • Enable EPEL repository by installing below package
yum install epel-release

Now, install pip with below command

yum install python-pip

And finally, use below to install ngxtop

pip install ngxtop

If using CentOS/RHEL 8 then you can use the DNF command like the following.

dnf install epel-release python2 python2-pip
pip2 install ngxtop

To Install ngxtop on Ubuntu

Use below command to install PIP

apt-get install python-pip

And now use following to install ngxtop

pip install ngxtop

Installation is easy. Isn’t it? Let’s see some of the real-time metrics.

Nginx Activity Summary

Use ngxtop command to view the summary of request count, requested URI, the number of requests by status code.

ngxtop

Tip: you can use to find a broken link by looking at a request, which has a status code as 404.

Check top client’s IP

It’s very handy to see who is making a large number of requests to your Nginx server.

ngxtop top remote_addr

ngxtop-remote-addr

How about displaying requests only, which has a 404 status code?

ngxtop -i 'status >= 404'

It’s not just real-time, but also you can analyze it offline by parsing access log.

To analyze access.log, you can use:

ngxtop –l /path/access.log

Another example would be to parse the offline access.log from Apache.

ngxtop –f common –l /path/access.log

There are multiple combinations you can use to filter out access.log for meaningful data. Next, you may want to try out Nginx Plus.

  • Chandan Kumar
    Author
    Chandan Kumar is the founder of Geekflare. He’s helped millions to excel in the digital realm. Passionate about technology, He’s on a mission to explore the world and amplify growth for professionals and businesses.
Thanks to our Sponsors
More great readings on Nginx
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder