Nmon: Analyze and Monitor Linux System Performance
Abstract: type of the file system and the mount point. Display NFS Data The key ‘N‘ can help to collect and display data on NFS. NFS Data So far it has been ver
If you are looking for a very easy to use performance monitoring tool for Linux, I highly recommend to install and use the Nmon command-line utility.
Nmon Monitoring ToolNmon is a system’s administrator tuner, benchmark tool that can be used to display performance data about the followings:
- cpu
- memory
- network
- disks
- file systems
- nfs
- top processes
- resources
- power micro-partition
A very nice thing I really like about this tool is the fact that it is fully interactive and helps the Linux user or the system administrator with the necessary command to get the most out of it.
Installing Nmon Monitoring Tool in LinuxIf you are using a Debian/Ubuntu based Linux distribution you can easily install the Nmon command-line utility by grabbing it from the default repositories.
To install, Open a new terminal (CTRL+ALT+T) and use the following command.
$ sudo apt-get install nmon
Are you a Fedora user? To install in your machine open a new terminal and run the following command.
# yum install nmon
CentOS/RHEL users can install it, by installing EPEL repository as shown:
# yum install epel-release # yum install nmonHow to use Nmon to Monitor Linux Performance
Once the installation of Nmon has been finished and you launch it from the terminal by typing the ‘nmon‘ command you will be presented with the following output.
# nmonNmon Preview
As you guys can see from the above screenshot, the nmon command-line utility runs completely in interactive mode and it presents the user with the keys to toggle statistics.
Check CPU by processorFor example, if you would like to collect some statistics on CPU performance you should hit the ‘c‘ key on the keyboard of the system you are using. After hitting the ‘c‘ key on my keyboard I get a very nice output that gives me information on my CPU usage.
CPU by ProcessorThe following are the keys you can use with the utility to get information on other system resources present in your machine.
- m = Memory
- j = Filesystems
- d = Disks
- n = Network
- V = Virtual Memory
- r = Resource
- N = NFS
- k = kernel
- t = Top-processes
- . = only busy disks/procs
To get stats on top processes that are running on your Linux system press the key ‘t‘ on your keyboard and wait for the information to show up.
Top ProcessesThose familiar with the top utility will understand and be able to interpret the above information very easy. If you are new to Linux system administering and have never used the top utility before, run the following command in your terminal and try to compare the produced output with the above one. Do they look similar, or is it the same output?
# top
It looks like I am running the top process monitoring utility when I use the key ‘t‘ with the Nmon tool to me.
Check Network StatisticsHow about some network stats? Just press ‘n‘ on your keyboard.
Network Statistics Disk I/O GraphsUse the ‘d‘ key to get information on disks.
Monitor Disk I/O Check Kernel InformationA very important key to use with this tool is ‘k‘, it is used to display some brief information on the kernel of your system.
Check Linux Kernel Information Get System InformationA very useful key for me is the key ‘r‘ which is used to give information on different resources such as machine architecture, operating system version, Linux version and CPU. You can get an idea of the importance of the key ‘r‘ by looking the following screenshot.
System Information Check File System StatisticsTo get stats on the file systems press ‘j‘ on your keyboard.
File System StatisticsAs you can see from the above screenshot, we get information on size of the file system, used space, free space, type of the file system and the mount point.
Display NFS DataThe key ‘N‘ can help to collect and display data on NFS.
NFS DataSo far it has been very easy to work with the Nmon utility. There are many other thing you need to know about the utility and one of them is the fact that you can use in data captured mode. If you don’t like the data to be displayed on the screen you can easily capture a small sample file with the following command.
# nmon -f -s13 -c 30
After running the above command you will get a file with ‘.nmon‘ extension in the directory where you were while working with the tool. What is the ‘-f‘ option? The following is a simple and short explanation of the options used in the above command.
- The -f means you want the data saved to a file and not displayed on the screen.
- The -s13 means you want to capture data every 13 seconds.
- The -c 30 means you want thirty data points or snap shots.
There are many tools that can do the job of the Nmon utility, but none of them is so easy to use and friendly to a Linux beginner. Unfortunately the tool does not have as many features as other tools such as collectl and it can not provide in-depth stats to the user.
At the end I can say it is a very nice utility for a Linux system administrator, especially for someone that is not familiar with command-line options and commands.