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 is a system’s administrator tuner, benchmark tool that can be used to display performance data about the followings:
- file systems
- top processes
- 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 Linux
If you are using a Debian 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.
$ sudo yum install nmon
How 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.
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 processor
For 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.
The 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
Top Process Statistics
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.
Those 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?
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 Statistics
How about some network stats? Just press ‘n‘ on your keyboard.
Disk I/O Graphs
Use the ‘d‘ key to get information on disks.
Check Kernel Information
A very important key to use with this tool is ‘k‘, it is used to display some brief information on the kernel of your system.
Get System Information
A 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.
Check File System Statistics
To get stats on the file systems press ‘j‘ on your keyboard.
As 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 Data
The key ‘N‘ can help to collect and display data on NFS.
So 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