If you are a Linux system administrator responsible for managing Linux systems, then you need a simple tool to monitor the Linux system resource usage. Nmon is a simple, lightweight, and handy tool that lets you see what’s going on in your server. Nmon provides a simple ncurses interface to display the Linux system resources usage like CPU, memory, network, disks, file system, NFS, top processes, resources, and more. It is a command-line tool so you can easily run it on the remote server via SSH.
This article will show you how to use Nmon to monitor Linux systems.
- A server running Linux.
- A root password is configured on the server.
By default, the Nmon tool is included in the default repository of all Linux-based distributions.
For Ubuntu and Debian-based distributions, you can install Nmon using the following command.
apt install nmon -y
For RHEL and CentOS-based distributions, you can install Nmon using the following command.
dnf install nmon -y
How to Use Nmon
Open your command line interface and just run the following command to launch the Nmon cli interface.
You will get the Nmon cli interface on the following screen.
Here, you will get all options to monitor your Linux systems.
Press the c keys to see the CPU stats of your system.
Press the m keys to see the Memory stats of your system.
Press the d keys to see the disk stats of your system.
Press the k keys to see the Kernel stats of your system.
Press the n keys to see the Network stats of your system.
Press the j keys to see the File system stats of your system.
After running Nmon, you will need to press any keys to check the specific stats of your system. You can also customize Nmon as per your requirements.
For example, run the following command if you want to see the Memory, CPU, Disk and Network usage information after running the Nmon command.
Next, run the Nmon command as shown below:
This will show you the Memory, CPU, Disk, and Network usage information in the following screen.
Capture and Analyze Data with Nmon
Nmon also allows you to capture the monitoring data in a file for later analysis.
Run the following command to start the Nmon in data collect mode.
nmon -f -s2 -c 30
This will capture the data and save it into a file named *.nmon.
You can verify the created file using the following command.
A brief explanation of each option is shown below:
- -f: Start Nmon in data collect mode.
- -s 2: Refreshing the screen every 2 seconds.
- -c 30: Define the total number of refreshes.
This post explained how to install and use the Nmon monitoring tool to monitor Linux systems. I hope this tool will help you to check the system resource usage easily via command line.