nmon stands for Nigel’s performance Monitor for Linux & AIX, developed by IBM employee Nigel Griffiths. Initially, it was developed for IBM AIX operating system, later a version written for Linux too and released as a open source under GPL on 2009.
nmon is a another nifty tool to monitor various system resources such as CPU, memory, network, disks, file systems, NFS, top processes, Power micro-partition and resources (Linux version & processors) on Linux terminal.
It support common architectures like POWER, x86, x86_64, Mainframe & now ARM (Raspberry Pi). This system administrator tuner, benchmark tool gives you a huge amount of important performance information which will help you to troubleshoot the system performance when you have the issues.
For real-time monitoring it uses curses library for low CPU impact and you can see the data directly on the screen and updated every two seconds. Alternatively you can save the data to file for later analysis.
So many command line system performance monitoring tool is available in Linux like Top, Htop, etc but why i wrote about nmon because we can enable/disable the required statistics widgets with any sequence but all other tools not like that.
Install Nmon on Debian/Ubuntu/Mint
Debian based users can install nmon easily from distribution official repository by using below command.
$ sudo apt-get install nmon
Install Nmon on Fedora
Fedora users can install nmon easily from distribution official repository by using below command.
$ sudo dnf install nmon
Install Nmon on RHEL/CentOS
RHEL/CentOS users need to install/enable EPEL Repository in order to install nmon.
$ sudo yum install nmon
Install Nmon on openSUSE
openSUSE users can install nmon easily from distribution official repository by using below command.
$ sudo zypper in nmon
How to use nmon to monitory system performance
nmon wont required high end tech skill to work on it. Just type nmon and hit enter you will be presented with welcome screen similar to this. Welcome screen itself you will get all the major options to work further.
To display/hide particular widgets statistics, just press the associated key. Say for example, if you want to display CPU utilization
, just press c
and press again the same key c
to hide the CPU utilization widgets statistics.
$ nmon ┌nmon─14g─────────────────────Hostname=2daygeek──Refresh= 2secs ───07:09.46───────────────────┐ │ │ │ ------------------------------ For help type H or ... │ │ # # # # #### # # nmon -? - hint │ │ ## # ## ## # # ## # nmon -h - full │ │ # # # # ## # # # # # # │ │ # # # # # # # # # # To start the same way every time │ │ # ## # # # # # ## set the NMON ksh variable │ │ # # # # #### # # │ │ ------------------------------ │ │ │ │ Use these keys to toggle statistics on/off: │ │ c = CPU l = CPU Long-term - = Faster screen updates │ │ m = Memory j = Filesystems + = Slower screen updates │ │ d = Disks n = Network V = Virtual Memory │ │ r = Resource N = NFS v = Verbose hints │ │ k = kernel t = Top-processes . = only busy disks/procs │ │ h = more options q = Quit │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Check CPU utilization by processor
Just press c
key, to see the CPU utilization based on the processor. Each CPU shows (user process, sys process & wait process utilization).
┌nmon─13g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:06.29───────────────────┐ │ CPU Utilisation ────────────────────────────────────────────────────────────────────────────│ │ +-------------------------------------------------+ │ │CPU User% Sys% Wait% Idle|0 |25 |50 |75 100| │ │ 1 0.5 0.0 0.0 99.5| > | │ │ 2 0.0 0.0 0.0 100.0| > | │ │ +-------------------------------------------------+ │ │Avg 0.2 0.2 0.0 99.5| > | │ │ +-------------------------------------------------+ │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Check memory utilization
Just press m
key to see memory utilization stats (cached, active, inactive, buffered, free in MB & free percent)
┌nmon─14g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:24.44───────────────────┐ │ Memory Stats ───────────────────────────────────────────────────────────────────────────────│ │ RAM High Low Swap Page Size=4 KB │ │ Total MB 32079.5 -0.0 -0.0 20479.0 │ │ Free MB 11205.0 -0.0 -0.0 20479.0 │ │ Free Percent 34.9% 100.0% 100.0% 100.0% │ │ MB MB MB │ │ Cached= 19763.4 Active= 9617.7 │ │ Buffers= 172.5 Swapcached= 0.0 Inactive = 10339.6 │ │ Dirty = 0.0 Writeback = 0.0 Mapped = 11.0 │ │ Slab = 636.6 Commit_AS = 118.2 PageTables= 3.5 │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Check disk utilization
Just press d
key to see disk utilization for each disk partition (each disk partition read, write shows in KB & busy shows in percent. Over all disk partition read & write shows in MB & data transfer rate shows in sec).
┌nmon─14g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:26.59───────────────────┐ │ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates────────────────│ │DiskName Busy Read Write Xfers Size Peak% Peak-RW InFlight │ │sda 0% 0.0 10.0KB/s 2.5 4.0KB 0% 18.0KB/s 0 │ │sda1 0% 0.0 0.0KB/s 0.0 0.0KB 0% 0.0KB/s 0 │ │sda2 0% 0.0 10.0KB/s 2.5 4.0KB 0% 18.0KB/s 0 │ │sda3 0% 0.0 0.0KB/s 0.0 0.0KB 0% 0.0KB/s 0 │ │sdb 0% 0.0 0.0KB/s 0.0 0.0KB 0% 0.0KB/s 0 │ │sdb1 0% 0.0 0.0KB/s 0.0 0.0KB 0% 0.0KB/s 0 │ │Totals Read-MB/s=0.0 Writes-MB/s=0.0 Transfers/sec=5.0 │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Check Network utilization
Just press n
key to see Network utilization based on the Network interface (Inter face name, Data received & Data send KB/s, packet in, packet out, insize, outsize & Total data transaction)
┌nmon─14g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:28.18───────────────────┐ │ Network I/O ────────────────────────────────────────────────────────────────────────────────│ │I/F Name Recv=KB/s Trans=KB/s packin packout insize outsize Peak->Recv Trans │ │ lo 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ eth0 0.0 0.0 0.0 0.0 0.0 0.0 5.2 22.4 │ │ eth1 0.0 0.2 0.5 0.5 60.0 330.0 2.0 15.4 │ │ eth2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ eth3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ bond0 0.0 0.2 0.5 0.5 60.0 330.0 7.3 37.8 │ │ usb0 0.1 0.1 1.5 1.5 65.3 79.3 9.9 11.7 │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Check Top processes
Just press t
key to see Top processes which is similar to Top command utility.
┌nmon─14g──────[H for help]───Hostname=2daygeek──Refresh= 2secs ───07:28.57───────────────────┐ │ Top Processes Procs=625 mode=3 (1=Basic, 3=Perf 4=Size 5=I/O)───────────────────────────────│ │ PID %CPU Size Res Res Res Res Shared Faults Command │ │ Used KB Set Text Data Lib KB Min Maj │ │ 16528 2.0 17720 4876 112 7384 0 948 308 0 nmon │ │ 1 0.0 19356 1520 140 404 0 1196 0 0 init │ │ 2 0.0 0 0 0 0 0 0 0 0 kthreadd │ │ 3 0.0 0 0 0 0 0 0 0 0 migration/0 │ │ 4 0.0 0 0 0 0 0 0 0 0 ksoftirqd/0 │ │ 5 0.0 0 0 0 0 0 0 0 0 stopper/0 │ │ 6 0.0 0 0 0 0 0 0 0 0 watchdog/0 │ │ 7 0.0 0 0 0 0 0 0 0 0 migration/1 │ │ 8 0.0 0 0 0 0 0 0 0 0 stopper/1 │ │ 9 0.0 0 0 0 0 0 0 0 0 ksoftirqd/1 │ │ 10 0.0 0 0 0 0 0 0 0 0 watchdog/1 │ │ 11 0.0 0 0 0 0 0 0 0 0 migration/2 │ │ 12 0.0 0 0 0 0 0 0 0 0 stopper/2 │ │ 13 0.0 0 0 0 0 0 0 0 0 ksoftirqd/2 │ │ 14 0.0 0 0 0 0 0 0 0 0 watchdog/2 │ │ 15 0.0 0 0 0 0 0 0 0 0 migration/3 │ │ 16 0.0 0 0 0 0 0 0 0 0 stopper/3 │ │ 17 0.0 0 0 0 0 0 0 0 0 ksoftirqd/3 │ │ 18 0.0 0 0 0 0 0 0 0 0 watchdog/3 │ │ 19 0.0 0 0 0 0 0 0 0 0 migration/4 │ │ 20 0.0 0 0 0 0 0 0 0 0 stopper/4 │ │ 21 0.0 0 0 0 0 0 0 0 0 ksoftirqd/4 │ │ 22 0.0 0 0 0 0 0 0 0 0 watchdog/4 │ │ 23 0.0 0 0 0 0 0 0 0 0 migration/5 │ │ 24 0.0 0 0 0 0 0 0 0 0 stopper/5 │ │ 25 0.0 0 0 0 0 0 0 0 0 ksoftirqd/5 │ │ 26 0.0 0 0 0 0 0 0 0 0 watchdog/5 │ │ 27 0.0 0 0 0 0 0 0 0 0 migration/6 │ │ 28 0.0 0 0 0 0 0 0 0 0 stopper/6 │ │ 29 0.0 0 0 0 0 0 0 0 0 ksoftirqd/6 │ └─────────Warning: Some Statistics may not shown──────────────────────────────────────────────┘
Check system information
Just press r
key to see varies system information like, kernel version, gcc version, CPU info, No of CPUs, Machine architecture, distribution name, distribution code name & distribution version no)
┌nmon─16f──────[H for help]───Hostname=daygeek──────Refresh= 2secs ───03:04.19────────────────┐ │ Resources Linux & Processor ────────────────────────────────────────────────────────────────│ │ Linux: Linux version 4.8.0-22-generic (buildd@lgw01-11) │ │ Build: (gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12) ) │ │ Release : 4.8.0-22-generic │ │ Version : #24-Ubuntu SMP Sat Oct 8 09:15:00 UTC 2016 │ │ cpuinfo: model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz │ │ cpuinfo: vendor_id : GenuineIntel │ │ cpuinfo: cpu MHz : 2592.002 │ │ cpuinfo: wp : yes │ │ # of CPUs: 1 │ │ Machine : x86_64 │ │ Nodename : daygeek │ │ /etc/*ease[1]: DISTRIB_ID=Ubuntu │ │ /etc/*ease[2]: DISTRIB_RELEASE=16.10 │ │ /etc/*ease[3]: DISTRIB_CODENAME=yakkety │ │ /etc/*ease[4]: DISTRIB_DESCRIPTION="Ubuntu 16.10" │ │ lsb_release: Distributor ID: Ubuntu │ │ lsb_release: Description: Ubuntu 16.10 │ │ lsb_release: Release: 16.10 │ │ lsb_release: Codename: yakkety │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Load more then one widgets
Just press c,m,d,n
key to see CPU, memory, disk & network utilization on your system.
┌nmon─14g─────────────────────Hostname=2daygeek──Refresh= 2secs ───07:30.42───────────────────┐ │ Memory Stats ───────────────────────────────────────────────────────────────────────────────│ │ RAM High Low Swap Page Size=4 KB │ │ Total MB 32079.5 -0.0 -0.0 20479.0 │ │ Free MB 11205.2 -0.0 -0.0 20479.0 │ │ Free Percent 34.9% 100.0% 100.0% 100.0% │ │ MB MB MB │ │ Cached= 19763.4 Active= 9617.8 │ │ Buffers= 172.5 Swapcached= 0.0 Inactive = 10339.5 │ │ Dirty = 0.0 Writeback = 0.0 Mapped = 11.0 │ │ Slab = 636.6 Commit_AS = 118.7 PageTables= 3.5 │ │ Network I/O ────────────────────────────────────────────────────────────────────────────────│ │I/F Name Recv=KB/s Trans=KB/s packin packout insize outsize Peak->Recv Trans │ │ lo 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ eth0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 5.9 │ │ eth1 0.0 0.1 0.5 0.5 60.0 234.0 0.1 2.9 │ │ eth2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ eth3 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ bond0 0.0 0.1 0.5 0.5 60.0 234.0 0.5 8.8 │ │ usb0 0.1 0.1 1.5 1.5 65.3 79.3 0.7 0.8 │ │ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates────────────────│ │DiskName Busy Read WriteKB|0 |25 |50 |75 100| │ │sda 0% 0.0 0.0|> | │ │sda1 0% 0.0 0.0|> | │ │sda2 0% 0.0 0.0|> | │ │sda3 0% 0.0 0.0|> | │ │sdb 0% 0.0 0.0|> | │ │sdb1 0% 0.0 0.0|> | │ │Totals Read-MB/s=0.0 Writes-MB/s=0.0 Transfers/sec=0.0 │ │─────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────────────────────────────────────────────────┘
Enjoy..)