LinuxCommandLibrary

nmon

Monitor system performance and resource usage

TLDR

Start nmon

$ nmon
copy

Save records to file ("-s 300 -c 288" by default)
$ nmon -f
copy

Save records to file with a total of 240 measurements, by taking 30 seconds between each measurement
$ nmon -f -s [30] -c [240]
copy

SYNOPSIS

nmon [interactive-keys]
nmon [-f] [-s <interval>] [-c <count>] [-o <filename>] [-t] [-m <directory>] [...other_options]

PARAMETERS

-s
    Specifies the data collection interval in seconds for batch mode.

-c
    Specifies the number of snapshots to capture in batch mode.

-f
    Enables the generation of a spreadsheet-formatted output filename (e.g., hostname_YYMMDD_HHMM.nmon).

-o
    Specifies the output data filename for batch mode. Typically used with -f.

-m
    Specifies the output directory for data files when using -f.

-t
    Includes top processes in the batch output file or interactive display.

-A
    Suppresses the collection of asynchronous I/O statistics.

-L
    Suppresses the collection of Logical Volume Manager (LVM) statistics.

-b
    Runs nmon in black and white mode, useful for non-color terminals.

-h
    Displays the help message with available options.

DESCRIPTION

nmon (Nigel's Monitor) is a versatile command-line tool designed for comprehensive system performance monitoring on Linux and AIX.

It provides a snapshot of various system resources, including CPU utilization, memory usage, disk I/O, network activity, top processes, file systems, and more. nmon can operate in two primary modes: an interactive, real-time display mode that updates statistics directly on the terminal, and a data collection mode that saves performance metrics to a file for later analysis. The output files generated in data collection mode are in a spreadsheet-friendly format, commonly analyzed using the nmon_analyzer tool.

Its lightweight nature and rich set of metrics make it an invaluable utility for identifying performance bottlenecks, understanding system behavior over time, and capacity planning. Originally developed by Nigel Griffiths at IBM for AIX, nmon was later ported to Linux and has become a widely adopted open-source tool for system administrators and performance engineers.

CAVEATS

While nmon is generally lightweight, running it with very short intervals or for extended periods in batch mode can consume noticeable system resources, especially CPU and disk I/O for writing logs.

The interactive mode requires the ncurses library to be installed on the system.

Analysis of the generated .nmon files typically requires external tools like nmon_analyzer (a spreadsheet macro) or other custom scripts, as nmon itself does not provide built-in graphical analysis.

INTERACTIVE COMMANDS

When nmon is run without options, it enters interactive mode. Various keys can be pressed to toggle different statistics views:
c: CPU utilization
m: Memory statistics
d: Disk I/O statistics
n: Network I/O statistics
t: Top processes
V: Virtual Memory and paging
q: Quit nmon

DATA ANALYSIS

Output files generated by nmon (typically with a .nmon extension) are colon-separated data, designed to be easily imported into spreadsheet applications. The official nmon_analyzer is an Excel macro that processes these files to generate graphs and detailed reports, simplifying the visualization and interpretation of performance data over time.

HISTORY

nmon was originally developed by Nigel Griffiths while working at IBM for performance monitoring on AIX systems. Due to its utility and efficiency, it was later ported to Linux and became an open-source project. Its development has been community-driven since its release as open-source, making it a staple in many Linux system administration toolkits. It continues to be updated and maintained, reflecting its ongoing relevance in system performance analysis.

SEE ALSO

top(1), htop(1), sar(1), vmstat(8), iostat(1), netstat(8), mpstat(1)

Copied to clipboard