mercoledì 23 aprile 2014

Nmon: Analyze and Monitor Linux System Performance

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.
Install Nmon in Linux

Nmon Monitoring Tool
Nmon is a system’s administrator tuner, benchmark tool that can be used to display performance data about the followings:
  1. cpu
  2. memory
  3. network
  4. disks
  5. file systems
  6. nfs
  7. top processes
  8. resources
  9. 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
CentOS/RHEL users can install it, by downloading it from http://pkgs.repoforge.org/nmon/. Alternatively, you can also install by enabling RPMForge Repository.

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.
# nmon
Nmon Preview

Nmon 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 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.
Monitor CPU by Processor

CPU by Processor
The following are the keys you can use with the  utility to get information on other system resources present in your machine.
  1. m = Memory
  2. j = Filesystems
  3. d = Disks
  4. n = Network
  5. V = Virtual Memory
  6. r = Resource
  7. N = NFS
  8. k = kernel
  9. t = Top-processes
  10. . = 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.
Monitor Linux Running Processes

Top Processes
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?
# 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 Statistics

How about some network stats? Just press ‘n‘ on your keyboard.
Monitor Linux Network Statistics

Network Statistics

Disk I/O Graphs

Use the ‘d‘ key to get information on disks.
Monitor Linux Disk I/O

Monitor Disk I/O

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.
Kernel Information

Check Linux Kernel Information

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.
Get Linux System Information

System Information

Check File System Statistics

To get stats on the file systems press ‘j‘ on your keyboard.
Monitor Linux File System

File System Statistics
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.
Monitor NFS

NFS Data
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.
  1. The -f means you want the data saved to a file and not displayed on the screen.
  2. The -s13 means you want to capture data every 13 seconds.
  3. The -c 30 means you want thirty data points or snap shots.

Conclusion

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.

Nessun commento:

Posta un commento