How to monitor resource usage on Linux using NMON
By Adarsh Sojitra on September 21st, 2022
After setting up your Ubuntu operating system and deploying your web and backend applications, they start to consume CPU, Ram, and Disk space like any other applications.
Sometimes we launch an operating system assuming specific resource usage. But often is the case that the application deployed will consume more CPU, Ram, and disk space than what was expected.
A DevOps engineer’s job is to continuously ensure that all the operating system resources are properly utilized and that the cost for the infrastructure is justified based on the resource utilisation of the application. Also, the server should never face any problems, such as lags, while running.
It is only possible once we have the numerical data that the application consumes, like CPU, Ram, and disk space.
We need to upgrade the server’s state if the application requires more resources than predicted. Similarly, If the application is using lower resources than predicted, you can downgrade your server to save money on infrastructure.
To monitor the system metrics, many third-party applications like Grafana and Prometheus are available; these applications are free to use, but a bit hard to set up, and their installation consumes more time.
On the other hand, you can also use the Linux commands to know RAM, CPU, Etc. However, it is repetitive and time-consuming.
There is an application called
nmon in Linux that allows you to quickly monitor resource utilisation on your server. It is quick and simple to install and use. If you never monitored the resource usage on your server, nmon is the easiest and the most efficient to get started.
In today’s tutorial, we will learn about how you can use NMON to monitor the system performance of your Ubuntu Linux operating system.
The first step we should know is how to install NMON on your Ubuntu operating system.
How To Install NMON On Ubuntu
We have provided the NMON installation screenshots for your reference. You must complete all these steps in a sequence, and the commands must be properly executed so that the NMON works properly.
Step 1: Execute –
$ sudo apt-get update
First, we have to update the apt, the packet manager of Linux, before installing NMON on your Ubuntu operating system. This step is optional but recommended so that you can get the latest available version of nmon.
Step 2: Execute –
$ sudo apt install nmon
The above command will install the NMON application on your Linux server. After the installation, you can directly start monitoring the metrics of your Ubuntu server.
Step 3: Execute –
Explanation: The above command will start the nmon application. Once it is ready, you will see a screen just like the following image.
As you can see in the above given image, you can monitor a lots of things on the server using nmon. Let’s learn How to use nmon on Linux.
How To Use NMON On Linux
Now that we know how to install NMON on your Ubuntu operating system, let us know how to use NMON to understand your system performance.
Using NMON is very simple. Enter the alphabets mentioned below on your terminal if you want to know a particular Ubuntu system metric.
You can use these keywords to monitor different things on your server.
- c = CPU
- l = CPU Long-term
- – = Faster screen updates
- C = ” WideView
- U = Utilization
- + = Slower screen updates
- m = Memory
- V = Virtual memory
- j = File Systems
- d = Disks
- n = Network
- . = only busy disks/procs
- r = Resource
- N = NFS
- h = more options
- k = Kernel
- t = Top-processes
- q = Quit
If you want to check the CPU performance of the Ubuntu machine, enter a lowercase c alphabet on the terminal. The NMON application then shows the CPU performance in a tabular form just like the following image.
Currently, no applications are running on my ubuntu, so CPU usage is almost zero.
If you want to know the disc space data, Enter the lowercase d alphabet from your keyboard. The terminal will now show the disk space metrics like the read speed, write speed and available disk.
All the data are represented in rows and columns. Also, a horizontal graph depicts percentage-wise data at 25% intervals.
Different colors are used for the user interface to understand it easily. Green is safe, and red is an alert.
There is a lot more to know about NMON. It is a small tool and is easy to install, but it can save you time and future trouble when it comes to cost saving or monitoring an application.
We have provided you with all the keywords with the help of which you can easily monitor your NMON in the operating system.
In this tutorial, we have learned what NMON is, how to install it, and how to use NMON to monitor the system’s performance.
We have also mentioned all the keywords for monitoring the specific system metrics by using NMON. This tutorial also provided screenshots for configuring purposes and other usages.
The installation process is very simple, but if you have faced any errors or have a doubt, please mention them in the comments section given below. We hope this tutorial helped you with Linux server monitoring using nmon. If you have any questions, feel free to comment in the comment section. We will be happy to help you.