How To Install Ngxtop on Ubuntu 20.04 LTS

Install Ngxtop on Ubuntu 20.04

In this tutorial, we will show you how to install Ngxtop on Ubuntu 20.04 LTS. For those of you who didn’t know, Ngxtop is a free, open-source, flexible, and real-time monitoring tool for Nginx web servers. It can parse the Nginx access log and print the information about request count, requested URI, the number of requests by status code, and much more.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Ngxtop real-time metrics for the Nginx server on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.

Install Ngxtop on Ubuntu 20.04 LTS Focal Fossa

Step 1. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

Step 2. Installing Python.

Run the following command below to install Python PIP:

sudo apt install python3 python3-pip

Step 3. Installing Ngxtop on Ubuntu 20.04.

With python and pip installed, now install Ngxtop using the following command below:

pip3 install ngxtop

Once Ngxtop is installed, you can verify the version of Ngxtop using the following command:

ngxtop --version

Step 3. Use Ngxtop.

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

Usage:
    ngxtop [options]
    ngxtop [options] (print|top|avg|sum) <var>
    ngxtop info

Options:
    -l <file>, --access-log <file>  access log file to parse.
    -f <format>, --log-format <format>  log format as specify in log_format directive.
    --no-follow  ngxtop default behavior is to ignore current lines in log
                     and only watch for new lines as they are written to the access log.
                     Use this flag to tell ngxtop to process the current content of the access log instead.
    -t <seconds>, --interval <seconds>  report interval when running in follow mode [default: 2.0]

    -g <var>, --group-by <var>  group by variable [default: request_path]
    -w <var>, --having <expr>  having clause [default: 1]
    -o <var>, --order-by <var>  order of output for default query [default: count]
    -n <number>, --limit <number>  limit the number of records included in report for top command [default: 10]
    -a <exp> ..., --a <exp> ...  add exp (must be aggregation exp: sum, avg, min, max, etc.) into output

    -v, --verbose  more verbose output
    -d, --debug  print every line and parsed record
    -h, --help  print this help message.
    --version  print version information.

    Advanced / experimental options:
    -c <file>, --config <file>  allow ngxtop to parse nginx config file for log format and location.
    -i <filter-expression>, --filter <filter-expression>  filter in, records satisfied given expression are processed.
    -p <filter-expression>, --pre-filter <filter-expression> in-filter expression to check in pre-parsing phase.

Congratulations! You have successfully installed Ngxtop. Thanks for using this tutorial for installing the Ngxtop real-time monitoring tool for the Nginx web server on Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you check the official Ngxtop website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!