Terminal GuideTerminal Guide

nmon

System Monitoring
Linux
C

Performance monitor for Linux with data capture.

Official Website

Features

Performance DataCSV ExportGraphsLightweight

Installation

APT (Debian/Ubuntu)
apt install nmon
DNF (Fedora)
dnf install nmon

Why Use nmon?

Comprehensive Performance Data

Monitor CPU, memory, disk I/O, network, filesystems, and process information all in one interface.

Data Capture & Export

Capture performance data to CSV files for historical analysis, trend analysis, and capacity planning.

Interactive Monitoring

Real-time interactive display with customizable views and the ability to drill down into specific metrics.

Lightweight & Efficient

Low overhead monitoring tool perfect for production environments and continuous monitoring scenarios.

Installation

installation
# Ubuntu/Debian
sudo apt install nmon

# Fedora/RHEL
sudo dnf install nmon

# Arch Linux
sudo pacman -S nmon

# CentOS 7
sudo yum install nmon

# Verify installation
nmon -h

Basic Usage

basic-usage
# Start nmon in interactive mode
nmon

# Monitor specific interface (e.g., eth0)
nmon -i eth0

# Record performance data to CSV
nmon -f -s 10 -c 120
# Writes data every 10 seconds for 120 iterations (20 minutes)

# Record with custom interval
nmon -f -s 5 -c 240
# Every 5 seconds for 240 iterations (20 minutes)

# Record specific metrics
nmon -f -N
# Record only network metrics

# Specify output directory
nmon -f -d /tmp/monitoring/

Key Shortcuts & Commands

KeyFunction
cShow CPU statistics
mShow memory statistics
dShow disk I/O statistics
nShow network statistics
pShow process statistics
fShow filesystem statistics
hShow help
qQuit nmon

Data Capture & Analysis

Recording Performance Data

nmon can capture performance data to CSV format for later analysis using spreadsheet applications or analysis tools.

data-capture
# Basic recording: every 30 seconds for 24 hours
nmon -f -s 30 -c 2880

# High frequency recording: every 1 second for 1 hour (use for detailed analysis)
nmon -f -s 1 -c 3600

# Specify output filename
nmon -f -n -s 10 -c 360
# Creates file like: hostname_120126_1300.nmon

# Check recorded files
ls -la *.nmon

# Generate reports from collected data
# Using nmon analyzer (requires separate tool):
# Visit: http://www.ibm.com/developerworks/wikis/display/nmon/nmon_analyser_v58+-+Workbook

Advanced Recording Options

advanced-recording
# Record only specific metrics
nmon -f -s 5 -c 240 -C  # CPU only
nmon -f -s 5 -c 240 -M  # Memory only
nmon -f -s 5 -c 240 -D  # Disk only
nmon -f -s 5 -c 240 -N  # Network only

# Record top processes
nmon -f -s 10 -c 360 -P

# Capture to specific output file
nmon -f -n -s 30 -c 2880 -o /var/log/monitoring/

Common Use Cases

1. Real-Time System Monitoring

realtime-monitoring
# Start interactive monitoring
nmon

# Navigate using interactive keys:
# Press 'c' for CPU, 'm' for memory, 'd' for disk, 'n' for network

2. Continuous Data Capture for Analysis

continuous-capture
# Run in background: capture every 2 minutes for 7 days
nmon -f -s 120 -c 5040 &

# Or with cron job for periodic monitoring:
# Add to crontab: 0 * * * * nmon -f -s 300 -c 288 -o /var/log/nmon/

# Check running nmon processes
ps aux | grep nmon

3. Capacity Planning & Trend Analysis

capacity-planning
# Collect baseline data for a week
nmon -f -s 300 -c 2016 -o /data/baseline/

# Analyze peak usage patterns
# Use Excel or gnuplot with the generated CSV files

# Compare different time periods
# Run nmon at regular intervals and compare the output files

4. Troubleshooting Performance Issues

troubleshooting
# Capture detailed data during issue occurrence
# Start recording before issue appears:
nmon -f -s 5 -c 600

# Then trigger or wait for the issue to occur
# Analyze the CSV data afterward to find correlations

# Monitor specific processes
# Use 'p' key in interactive mode to show top processes

Tips

1. Choose Appropriate Sampling Intervals

For real-time troubleshooting, use 1-5 second intervals. For long-term trending, use 5-minute or longer intervals to reduce file sizes.

2. Manage Data Storage

Collected CSV files can grow large. Use compression or archive old files regularly. Consider storing data on a dedicated monitoring server.

3. Use nmon Analyzer for Visualization

IBM provides nmon analyzer (Excel macro) to convert CSV data into charts and graphs. This makes trend analysis much easier.

4. Background Monitoring Setup

Run nmon data collection in the background using nohup or as a cron job for continuous monitoring without occupying a terminal session.

5. Monitor Multiple Systems

Use nmon on multiple servers and centralize the CSV files for comparative analysis across your infrastructure.

Written by Dai AokiPublished: 2026-01-20

Related Articles

Explore More