Using nmnon To Monitor Linux System Performance On Azure

Nmon (Nigel’s performance Monitor for Linux) is another very useful command line utility that can display information about various system resources like cpu, memory, disk, network etc. It was developed at IBM and later released open source.  It works on Linux, IBM AIX Unix, Power, x86, amd64 and ARM based system such as Raspberry Pi.

Here I will actually show you this utility and how it works by running it on Linux VM in Microsoft Azure. Why Azure? Because I can spin up VM, run tool on it and destroy it when not needed vs. creating a separate VM for Hyper-V or VirtualBox.

Creating Ubuntu Linux VM is deceptively simple in Azure. Just login into portal, pick Ubuntu from Virtual Machine Gallery and here you go:

image

However, there is one thing… You will need an SSH certificate to connect to your Linux VM, therefore Azure expects you to have one when you create your VM. To do that I had to install Cygwin and follow directions from here – http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-use-ssh-key/

Using Cygwin you should be able to generate key and then certificate after (.cer file)

image

To be fair I did attempt to use OpenSSL for Windows to do same first, but Cygwin ended up a lot easier.

Once VM is created you will still need to download Putty to get to it – http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Puttygen may not be able to read the private key that was created earlier (myPrivateKey.key). Run the following command to translate it into an RSA private key that Puttygen can understand:

image

Now lets import that key into Puttygen. I am still following instructions from Azure doc link above. Now I will run PuTTY and attempt to connect to IP of my Ubuntu Azure role that I got from Azure

linuxputtyconfig

Next also add your key

linuxputtyprivatekey

Next get this warning:

image

Finally I can connect:

image

Next I am going to make sure all my packages are up to date via

sudo apt-get update

Next I will install nmon.  That can be done via:

sudo apt-get install nmon

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.

image

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.

image

Lets add memory by hitting ‘m’ and virtual memory by hitting ‘V’

image

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

I can get stats on top processes running on my Linux system by using ‘t’

image

Of course there are other utilities you can use to troubleshoot and monitor Linux, but overall I find nmon really the easiest. If you are running systems like Java on Linux in Azure make sure you use this utility in conjunction with JVM troubleshooting tools such as jstack and  jmap and jhat, as I described previously.

For more see – http://www.cyberciti.biz/faq/nmon-performance-analyzer-linux-server-tool/, http://www.tecmint.com/nmon-analyze-and-monitor-linux-system-performance/, http://www.binarytides.com/nmon-linux-system-monitor/

Happy troubleshooting…

Advertisements

2 thoughts on “Using nmnon To Monitor Linux System Performance On Azure

  1. Pingback: Meet Redis – Setting Up Redis On Ubuntu Linux | A posteriori
  2. Pingback: Forecast Cloudy – NGINX On Microsoft Azure | A posteriori

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s