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.
Prerequisites
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, and any other Debian-based distribution like Linux Mint or elementary OS.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
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.