Recent Changes - Search:

Home Page


Screen shots


Download Binaries


Getting Started


Documentation


Compiling nmon
+ Source Code


Support


nmonchart


edit SideBar

CompilingNmon

nmon for Linux - Compiling the Source Code

  • Assuming you can't find a pre-compiled version (See Download Binaries in the left Menu) or want a really fresh version to match your Linux system.

nmon is pretty simple to compile - the whole thing takes no more than 3 minutes if you have your distro OS DVD media online:

  1. Download the latest source code (it is just one file names lmon<version>.c) and the makefile
  2. Install the GCC C Compiler, ncurses development library and (if its not already available) Install the make command
  3. Hard link the latest C source code file to the filename lnom.c (lmon.c is used in the makefile)
  4. Edit the makefile to find your platform, OS and version in the makefile or make a new one
  5. Run make and you have a new version in roughly 4 seconds. Ready to run.

For action 1: Just click on the link below to open in a different Tab and wait 10 seconds. The download should continue automatically. Ignore all the horrible adverts and deliberately confusing screen messages. I suspect lots of those links will download viruses, malware and worse.

Downloads

Download FileComments
lmon15g.cVersion 15g - 27th July 2015
Window management change to remove odd left-over characters
Added code for TOP processes order by disk I/O (needs root access)
Reduce file capture time drifting
lmon15f.cVersion 15f - 9th July2015
User Defined Disk Groups automatically make the file with just the disks : nmon -g auto
Use -D for extra disk stats and Disk backlog - use with -g auto
lmon15e.cThis is the current source code beta version 15e - 5th May 2015
Change file system stats to match df output (allow for root user reserved space)
lmon15d.cVersion 15d - 14th April 2015
Added AAA,steal,1 line to nmon files to easily workout if CPU steal stats are present.
makefileUsed to compile nmon
Older versionsUse these, if we have introduced a bug in the latest version above
lmon14i.cPrevious stable source code version
lmon14g.cEven older stable source code version

For action 2: you have to work out how to do that for your Linux flavour. Hints:

  • Debian / Ubuntu
    • sudo apt-get update
    • sudo apt-get install gcc*
    • sudo apt-get install ncurses-dev*
      • Ubuntu 15.04 calls this package libncurses5-dev - Heck know why?? but very hard to work out?
    • sudo apt-get install make
  • Fedora / Redhat - as the root user
    • yum install gcc*
    • yum install ncurses-dev*
    • yum install make
  • OpenSUSE / SUSE - as the root user
    • yast install gcc*
    • yast install ncurses-dev*
    • yast install make

For action 3: Assuming the version you just downloaded is 99z with: ln lmon99z.c lmon.c

For action 4: Assuming you are OK with some UNIX/Linux editor like vi.

  • Edit the makefile - You are looking for the right combination of
    • Platform (Power, x86 x86_64 or mainframe)
    • Linux distribution
    • Linux version

Examples:

  1. You have a POWER processor based machine and running SLES 11.3 - look for the lines starting nmon_power_SLES113
  2. You have a old 32 bit AMD or Intel processor based machine and running RHEL5 - look for the lines starting nmon_x86_RHEL5
  3. You have a 64 bit AMD or Intel processor based machine and running Ubuntu 14.10 - look for the lines starting nmon_x86_64_ubuntu1410

If you find a match remember the exact name for the make file command below.

If you don't find a match you need to make one by copying the nearest match and making changes.

  • Select one using the Processor - there are compile time options for each processor. Then one with a similar Linux version.
  • Don't worry about Big and Little Endian - the compiler will compile for what ever you are currently running on.

Example: Ubuntu 15.4 is just out and you have a power CPU
The closest entry is
nmon_power_ubuntu1410: $(FILE)

        gcc -o nmon_power_ubuntu1410 $(FILE) $(CFLAGS) $(LDFLAGS) -D POWER -D KERNEL_2_6_18

Copy and change this to
nmon_power_ubuntu1504: $(FILE)

        gcc -o nmon_power_ubuntu1504 $(FILE) $(CFLAGS) $(LDFLAGS) -D POWER -D KERNEL_2_6_18

For action 4:

  • You are ready to compile with: make nmon_power_ubuntu1504
    • or using the Platform + Linux Disto + version that you found in the makefile.
  • The nmon binary will be in your local directory and called: nmon_power_ubuntu1504
    * You can:
    • rename the nmon command to something smaller
    • or link it to say nmon with: ln nmon_power_ubuntu1504 nmon
    • or if root install nmon in a regular path: cp nmon_power_ubuntu1504 /usr/bin/nmon

Hope you get your nmon working, Cheers Nigel



Older version below - please ignore



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
lmon15c.c200 KB13 April 2015 - Beta release:
Improved NFS (again), CPU Steal stats saved to file and online, Big&Little Endion noticed and recorded, better 1st flash screen, saving more config: lsblk & lscpu, PowerKVM support
lmon15b.c198 KB18 March 2015 - Beta release:
Remove bug for more than 256 logical CPUs (CPU Core threads) for POWER8 with SMT=8 benchmarks
lmon15a.c
lmon15a_README.txt
198 KB23 Feb 2015 - Beta release:
Only try this beta test version if:
a) Using PowerKVM host or guest
b) Want initial online splash screen improvements
c) Want improved NFS stats
d) Want to collect new commands in the output file
Compile it yourself (no change there) - it is easy.
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.
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.

Compiling

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
      	nmon_x86_64_ubuntu810: 
      		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 July 30, 2015, at 09:41 AM