nmon

On this page 7

nmon (Nigel’s performance Monitor) is a terminal-based performance monitoring tool for Linux and AIX that displays CPU, memory, disk, network, file system and process statistics on one screen and can also record them to a file at fixed intervals for later analysis. In Linux monitoring it sits between interactive viewers such as top and htop and long-term collectors such as sar.

Its distinguishing feature is the dual mode of operation: an interactive curses display that an administrator toggles section by section, and a capture mode that writes timestamped snapshots in a comma-separated format suitable for spreadsheets and graphing tools.

How nmon collects and displays data

nmon reads its figures from the procfs and sysfs interfaces, mainly files such as /proc/stat, /proc/meminfo, /proc/diskstats and /proc/net/dev. It samples these counters at each refresh, computes differences between samples and turns them into rates such as percent CPU busy, kilobytes per second or transfers per second.

The interactive screen is built from sections that the user switches on with single keys. Several sections can be shown at once, so an administrator can watch CPU, disks and network together while reproducing a problem.

KeySectionWhat it shows
cCPUPer-core user, system, wait and idle bars
mMemoryRAM, swap, cache and buffer usage
dDisksRead and write throughput per device
nNetworkReceive and transmit rates per interface
tTop processesProcesses sorted by resource use
jFile systemsSize, used and free space per mount
kKernelRun queue, context switches, interrupts
qQuitExits the program
Frequently used interactive keys

The refresh interval defaults to two seconds and can be changed with the -s option. Shorter intervals reveal brief spikes but add measurement overhead and make the display harder to read.

Recording mode and the nmon file format

In recording mode, nmon runs unattended in the background and writes one snapshot per interval to a file named after the host, date and time with the .nmon extension. The command nmon -f -s 60 -c 1440 captures one snapshot per minute for 24 hours, a common baseline for daily analysis.

The following options control what is captured and for how long.

OptionMeaningTypical use
-fWrite to a file instead of the screenEvery capture run
-s secondsInterval between snapshots10 to 300 seconds
-c countNumber of snapshots to takeSets total duration with -s
-tInclude top processesFinding which process causes load
-m directoryOutput directoryStoring captures on a separate disk
-F filenameExplicit output file nameScripts and scheduled jobs
Main nmon capture options

Each line of the output starts with a section tag such as CPU_ALL, MEM, DISKREAD or NET, followed by a snapshot identifier and values. Tools such as the nmon analyser spreadsheet and nmonchart convert these files into graphs, and many administrators load them into scripts or time-series databases.

nmon compared with other Linux monitoring tools

nmon overlaps with several standard tools, and the choice depends on whether the task is live diagnosis, recording or deep tracing. The comparison below places nmon among its closest neighbors.

ToolPrimary strengthRecordingScope
nmonAll subsystems on one screenYes, CSV-like fileSystem-wide
top and htopProcess list and CPUNoProcesses
sarLong-term history via sysstatYes, binary filesSystem-wide
atopPer-process resource accountingYes, binary filesSystem and process
GlancesWeb and API outputExport pluginsSystem-wide
iostat and vmstatFocused subsystem countersNoDisk or memory
nmon and related monitoring tools

The practical difference from sar is that nmon files are plain text and self-contained, so they can be copied to a workstation and opened without the sysstat tools. The trade-off is larger file sizes and no built-in daemon for permanent collection.

Interpreting nmon output correctly

Reading nmon well requires knowing what each counter actually measures. CPU wait time indicates idle CPUs with outstanding I/O, not a busy processor, and high values point to storage latency rather than a lack of compute power.

  • Memory shown as cached is reclaimable page cache, so low free memory alone is not a problem.
  • Disk busy near 100 percent on SSD or NVMe devices can be misleading, because these devices serve many requests in parallel.
  • Run queue longer than the core count for sustained periods indicates CPU saturation.
  • Swap activity, not swap usage, is the signal of memory pressure.
  • Network figures are throughput only and do not show packet loss or retransmissions.

For more precise saturation signals, nmon data is often combined with Pressure stall information from the kernel, which measures how long tasks actually waited for CPU, memory or I/O.

Practical use and common mistakes

nmon is most valuable for capturing a reproducible baseline before a change and comparing it with a capture taken afterward. It is available as a package in most distributions and runs as a single binary with very low overhead, typically well below one percent of one core at minute-level intervals.

SituationRecommended settingReason
Daily capacity baseline-f -s 60 -c 1440Full day at manageable size
Short load test-f -s 5 -c 720One hour with fine detail
Live incident triageInteractive with c, d, m, tImmediate view of all subsystems
Process attributionAdd -t to captureLinks load to specific processes
Choosing nmon settings for a task

Common mistakes include leaving captures running indefinitely and filling a file system, using intervals so short that files grow to hundreds of megabytes, and comparing captures taken with different intervals. Another frequent error is treating averages as peaks, because a 60-second sample hides spikes that last a few seconds.

In simple terms

nmon is like a dashboard for a Linux computer. It shows on one screen how hard the processor is working, how much memory is in use and how busy the disks and network are.

It can also act like a flight recorder, writing down these numbers every minute so that someone can look back later and see exactly when and why the machine slowed down.

A practical example

An operations team supports a Linux database server whose nightly batch job has started finishing two hours late. Users report slow reports each morning, but by the time anyone logs in, the server looks idle.

The administrator schedules nmon -f -t -s 30 -c 960 through cron to start at 22:00 and run for eight hours. The next morning, the capture is opened in a graphing tool and shows CPU wait time above 40 percent from 01:10 onward, while one disk reads at full throughput and the top-process section points to a backup job.

The backup had been moved to the same volume as the database files during a storage migration. After it is rescheduled to start at 04:00, the batch job again finishes within its two-hour window, and the next nmon capture confirms that disk wait has fallen below 5 percent.