Recent Changes - Search:

Home Page

Screen shots


Getting Started


Compiling nmon


edit SideBar


nmon for Linux Compiling

Source code

nmon for Linux source code is released under the GPL license.

  • There is just a single source code file written in C and a makefile - nice and simple.
  • You need the GNC C compiler and ncurses-dev package installed.
Download FileSizeComment
lmon14i.c198 KB1st August 2013 - new features:
1 2nd attempt at fixing my NFS stats bug - thanks to helpful users.
2 Dynamic memory handling for massive /proc/cpuinfo file &
so much duplication & Tabs chars plus many formats on x86.
3 POWER has new LPAR details on the CPU stats online, Entitlement, Physical CPU used, Capped,
SMT level, virtual Processors and Dotted lines on each primary thread helps you "see" the
physical CPUs, plus file output saves the above, lparstat -i, ppc64_cpu & lsslot,
ls-veth/vdev/vscsi, lscfg & bootlist commands output, saves SMT on the LPAR tab last column.
4 Start up flash panel has X86 or POWER CPU details.
Note: some x86 Virtual Machines report CPU type QEMU or Virtual CPU but many don't.
5 WARNING: for x86 add -D X86 in the makefile to get the new features.
The below makefile has been updated or get it here makefile.
If these don't interest you, please carry on running nmon for Linux 14g.
lmon14h.c188 KB3rd July 2013 - bug fix for:
This included a fix for POWER based machines when the Entitlement CPU
is set below 10% of a CPU - only applies to the POWER7+ processors or
POWER7 that has a firmware upgrade like Power 770/780/79 and a fix for
a crash if you gather NFS serving stats on certain Linux distributions
& versions - one combination effected was RHEL 6.3.
If these don't interest you, please carry on running nmon for Linux 14g.
lmon14g.c188 KB4th June 2011 - Larger specific fixes for:
1) TOP process memory page-size fixed for 64 KB memory page systems
- Old Linux versions compiled for 4 KB page-size
- Typically New server Linux versions use 64 KB page-size (run: getconf PAGESIZE to find out)
- Fixed output TOP process sizes on-screen and also the optional Top processes section in the nmon data file
2) Added Page Size to the online memory section
3) Added netstat (fixed typo), uptime and getconf PAGESIZE to nmon data file BBBP section
If you have 4KB pages then version 14f will work fine = no need to upgrade.
lmon14f.c188 KB2nd Jan 2011 - Minor specific fixes for:
1) TOP process stats saved to file have 2 decimal places (was 1) for more accuracy.
lmon14e.c188 KB14th Dec 2010 - Minor specific fixes for:
1) if you have more than 100CPUs the CPU10 and CPU100 stats wrong
lmon14d.c188 KB17th Nov 2010 - Minor specific fixes for:
1) Microscopic bug in NFS stats saved to file (an extra comma but worth fixing)
lmon14c.c188 KB17th Nov 2010 - Minor specific fixes for:
1) Fixed File System sizes, if you have odd filesystems with 1KB blocks (found on RedHat RHEL 5.5)
without the the sizes are 4 times large than reported with df -m
Any one understand why/how these are created? My Power based machine has 4KB / and 1K /boot !!
2) Fix for machines with more than 99 CPUs (found on Power based machines
Don't forget to add compiler -D KERNEL_2_6_18 option for Linux Kernel this level or high for some extra features.
lmon14a.c185 KBCurrent source code: Bugs fixes for:
1) Fixed two fclose() missing after error issues. This may stop a few crashes when you have 100's of short lived processes - resulting is too many open files. Big thanks to the guys that pointed these out.
2) Added NFS v4 stats - online hit N a second time, data collect mode use -N as normal. Only reported if found switched on. NFS v4 has 75 statistics instead of v2=18 and v3=22 so they can be displayed side by side.
3) Added KERNEL_2_6_18 compile time option for later Linux kernels to add features from this release onwards: Threads & IO time for processes in TOP process output - would be nice to add Threads to the online view too.
4) Added EXPERIMENTAL compile time option for stuff to be tested more
5) Disk Group stats include group reads, writes, merges, service times, in-flight and IO time
6) Fixed major bugs in /proc/vmstat data handling
7) For POWER7 added SMT=4 reporting
8) Fix for 256 CPU as found in POWER7 machines, includes 3 digit CPU counts - could cause problems with down stream tools that assume CPU numbers are 2 digit numbers.
9) More command output saved in BBBP section - best to capture and look for a list. Include miltipath command and configuration, ppc64-utils like lscfg and netstat -r
10) Captured more from POWER /proc/ppc64/lparcfg (not output yet)
11) Flags to stop multiple reads of the same file for different reasons in one update.
Lots of this is from Ralf Schmidt-Dannert
lmon13g.c159 KBOlder source code: Bugs fixes for:
1) Tracked down the User Defined Disk Groups bug with David Baril's help
2) Now collects the /proc/diskstats in the BBB section
3) Minor typo's fixed in the help and hints and column widths in the on-screen network stats
lmon13d.c159 KBBugs fixed from 12f are:
1) Added POWER Active Memory Sharing stats both Online (see Memory) and to capture file,
2) Changed online colour graphs to use black foreground so that stats meaning is clearer
3) Fixes to user defines disk groups stats (online and capture)
4) Added Online Disk Totals and duplicate warning
5) Added Online disk ignore first update of erroneous data
6) Added file capture data: df, mount and fstab capture to BBB lines
7) Fixed Online disk map (rain diagram) output
8) Online disk changes from KB to MB, if numbers are too large for screen space
9) Bug fixes and code from Brian Smith & David Baril (well done and thanks)
lmon12f.c154 KBPrevious source code
Bugs fixed from 12e are:
1) Fix online mode Curses crash (malloc off by one failure - my fault),
2) Online colour graphs for CPU, CPU long term (hit lowercase L) & disks
- Code and fixes from Brian Smith (well done and thanks)
lmon12e.c154 KBBugs fixed from 12c are:
1) Large CPU counts fail due the massive size of /proc/cpuinfo on Intel/AMD
lmon12d.c152 KBDifferences from 12b in the download binaries are:
Copyright & includes small fix for 64 way POWER machines
makefile2 KBBuild instructions for the make commend
Documentation.txt1 KBSmall file primarily to help build processes that wants a licence and documentation file

File name:

  • The file for compiling is called lmon.c for historic reasons.
  • For release reasons the version is added
  • The number in the file name is the major release i.e. this is increased when new function is added.
  • The letter in the file name is increase as bugs are removed and the new code is released.


The process is as follows:

  1. Download the source code file
  2. Download the makefile
  3. Rename the source code file to lmon.c (mv lmon12d.c lmon.c) or add a link (ln lmon12d.c lmon.c)
  4. vi the makefile and find the directive that matches your platform and Linux release
    • Note: some of the older versions have extra defined compile time options (-D SOMETHING) to switch on code to work around bugs in the operating system or some platforms have extra features so defined options pull in the code to handle it.
    • If necessary, create a new line to create a nmon file specific to your new Linux Distro / platform combination.
  5. Make nmon, for example to compile nmon for x86_64 for Ubuntu
    • You find the following in the makefile
      		cc -o nmon_x86_64_ubuntu810 $(FILE) $(CFLAGS) $(LDFLAGS) -D X86
    • To compile run: make nmon_x86_64_ubuntu810
  6. Yes, it is that easy.
  7. Testing - normally it is very obvious if there is problems.
    • Run some workload
    • Use nmon online - and check the numbers for CPU, memory, disks and top processes look about right
    • If the numbers are all zeros - suspect you have a problem
    • Then use nmon for Linux to to collect data to a file
    • Once the file output is complete
      • Use vi to check the output file - it is simple text. Does the last like look OK?
      • grep the ZZZ lines to check nmon for Linux ran to completion - one of these lines is output for each capture with a time and date.
      • Use you nmon for Linux output file analyser to check it understands the output.
Edit - History - Print - Recent Changes - Search
Page last modified on August 01, 2013, at 03:10 PM