An excellent Linux monitoring tool--nmon

Source: Internet
Author: User
Tags cpu usage

(i) Nmon tools overview

Nmon is a tool for Linux server monitoring, through the Nmon, can be implemented to monitor the following parameters:

--CPU usage Rate

--memory, swap space utilization

--Usage of network

--Disk I/O, read/write speed

--Network I/O speed, transmission and read/write speed

--top-level process to see which applications are consuming more CPU

--Network File system NFS

--File system usage (similar to df-h)

etc...

(ii) Deployment of Nmon Tools

STEP1. Download the installation package: Http://nmon.sourceforge.net/pmwiki.php?n=Site.Download.

Note: Depending on your Linux type and version, you need to choose the appropriate installation package, my Redhat 6.6 linux information is

Lsb_release:distributor Id:redhatenterpriseserver
Lsb_release:Description:Red Hat Enterprise Linux Server Release 6.6 (Santiago)

, the "nmon_x86_64_rhel6" below nmon16e_mpginc.tar.gz can be used for testing.

STEP2. Unpacking the installation package

[Email protected] ~]#mkdir/opt/nmon/Nmon16e[[email protected] nmon16e]#pwd/opt/nmon/Nmon16e[[email protected] nmon16e]#Tar-XZVF Nmon16e_mpginc.Tar. Gz...nmon_x86_64_opensuse12nmon_x86_64_rhel6nmon_x86_64_rhel7. [Email protected] nmon16e]# lltotal12540-rw-r--r--.1Root root3456878The - Ten: -Nmon16e_mpginc.Tar. GZ-rw-r--r--.1Root root383072Apr -   .NMON_ARM_UBUNTU15-rwxr-x---.1Root root342054Apr -   .nmon_power_32_rhel6-rwxr-x---.1Root root353612Apr -   .NMON_POWER_32_SLES11-rwxr-x---.1Root root460578Apr -   .nmon_power_64_kvm2-rwxr-x---.1Root root464824Apr -   .Nmon_power_64le_fedora22-rwxr-x---.1Root root464824Apr -   .nmon_power_64le_rhel6-rwxr-x---.1Root root464824Apr -   .Nmon_power_64le_rhel7-rwxr-x---.1Root root540615Apr -   .NMON_POWER_64LE_UBUNTU14-rwxr-x---.1Root root561504Apr -   .NMON_POWER_64LE_UBUNTU15-rwxr-x---.1Root root551472Apr -   .nmon_power_64le_ubuntu16-rwxr-x---.1Root root405725Apr -   .nmon_power_64_rhel6-rwxr-x---.1Root root460578Apr -   .Nmon_power_64_rhel7-rwxr-x---.1Root root418328Apr -   .NMON_POWER_64_SLES11-RWXR-----.1Root root347506Apr -   .NMON_X86_64_CENTOS6-RWXR-----.1Root root402146Apr -   .Nmon_x86_64_centos7-RWXR-----.1Root root345503Apr -   .Nmon_x86_64_opensuse11-RWXR-----.1Root root394628Apr -   .Nmon_x86_64_opensuse12 -rwxr-----. 1 root root 347506 Apr      nmon_x86_64_rhel6 -RWXR-----.1Root root402146Apr -   .Nmon_x86_64_rhel7-RWXR-----.1Root root345503Apr -   .NMON_X86_64_SLES11-RWXR-----.1Root root394628Apr -   .NMON_X86_64_SLES12-RWXR-----.1Root root481776Apr -   .Nmon_x86_64_ubuntu15

STEP3. Find the file corresponding to your own operating system, directly execute, you can enter the Nmon tool

[Email protected] nmom6e]#./nmon_power_64_rhel6

(iii) Nmon real-time monitoring

Real-time monitoring can be done using Nmon, which consists of three main types of commands:

    • Help commands
    • Monitoring Parameters Command
    • Monitoring auxiliary commands

(3.1) Help command

The help command is "H", and the command and function of Nmon can be learned by the H command.

(3.2) Monitoring command

Command English explanation Role
 c | C

C = CPU Util        

C = Wide View    ;

used to monitor CPU usage. Statistics for four states per core CPU:

user%: User uses CPU percent                  sys%: System uses CPU percent

Span style= "Font-family:microsoft Yahei; font-size:12px; " >

 m | L

m = memory & swap ;   

L = Large (Huge) page

used to monitor memory and swap space usage , you can also use the "L" command to view the usage of large (Huge) page
 n n = Network

  monitors the I/O status of each NIC, mainly monitors

 --number of package in and out of the network card

 --Incoming and outgoing traffic (default is 2 seconds)

 - Peak of traffic received/sent per second

D

D = Disk I/o Graphs

D = Status

Monitor disk I/O, with this command, you can see the disk is busy, read and write speed, with "D" can see more detailed disk I/O information

Note: If the disk SDA partition becomes: sda1, sda2, then the information for three disks (SDA, SDA1, sda2) is displayed.

K K = Kernel status & loadavg

Monitoring the kernel state and load, this parameter can be used to understand where the CPU is consumed specifically

--Full CPU usage load, where the CPU is consumed is also described, unlike the previous C or C for a single CPU statistic

--average load on all CPUs (1min, 5min, 15min)

M M = MHz by Thread & CPU Clock oscillator frequency of the CPU
T

t = Top Process, optional parameters:

--1:priority/nice/state

--3:cpu

--4:ram

--5:i/o

Top-level processes that can be sorted by a bit

--1: Basic way, personal feeling not practical

--3: Sort by CPU consumption

--4: Sort by memory consumption

--5: Sort by I/O consumption

G g = User Defined Disk Groups User-defined disk group information
R r = Resources OS & Proc

Operating system resource information, such as:

--CPU model, CPU frequency, physical core per CPU, Hyper-threading, number of virtual CPUs

--OS Version: Linux version, redhat version

L L = Long term CPU averages Long-term CPU load monitoring. Similar to the CPU monitoring functionality provided by Windows Task Manager
V v = Virtual Memory Virtual Memory usage
N N = NFS NFS Network File System I/O statistics
O o = Disk%Busy Map Map that records which disks are in use and which disks are not used
J j = Filesystem Usage File system usage, similar to df-h
U U = Top Process with command line hit U twice to update Top-level process with two time to update data operations
G G = with-g Switches disk Graphs to disk groups only Not clear specific role, slightly

(3.3) Auxiliary monitoring command

Command English explanation Role
"+" (shift+ "+") "+" = double the screen refresh time Screen refresh rate changed to twice times
"-" (shift+ "-") "-" = half the screen refresh time Change the screen refresh rate to half
“.” "." = Display only busy disk & CPU Mark the CPU in a busy state
0 0 = Reset Peak marks (">") to zero Reset the peak to 0
Space Space Refresh Screen Now Spacebar to manually refresh the screen
B Black & White Mode Color is displayed in black and white mode
Q Q = Quit Exit

(iv) Nmon data non-real-time analysis

In addition to real-time analysis, you can collect data and then use the Nmonchart, Nmon_analyser tools to draw and present the collected data.

The Nmon collects data commands as follows:

[Email protected] nmom6e]#./nmon_x86_64_rhel6-s1-c300-f-m/opt/nmon/nmon16e/file

Parameter description:
-S1: Sampling once every n seconds, here is 1s;
-C300: Number of samples, here is 300 times;
-F: Output file name in standard format:
-M: File output path

Eventually a Nmon file is generated, and after you get the Nmon file, you can use Nmonchart or Nmon analyser to draw the graphic.

Next introduce the usage of Nmonchart and nmon_analyser.

(4.1) generating graphics using Nmonchart

As mentioned above, Nmon collects data, it forms a *.nmon file, and we can use Nmonchart to generate the HTML server performance report.

Nmonchart: Http://nmon.sourceforge.net/pmwiki.php?n=Site.Nmonchart

Use syntax: Nmonchart <nmon-file> <output-file>.html

Example: Converting Redhat6_180814_1014.nmon to an HTML graphical report using Nmonchart

[Email protected] ~]/opt/nmon/nmon16e/nmonchart/nmonchart  /opt/nmon/nmon16e/file/redhat6_180814_ 1014.nmon  /opt/nmon/nmon16e/file

Execution prompt Exception:-bash:./nmonchart:/usr/bin/ksh:bad interpreter:no such file or directory

Workaround:

Nmonchart need to use Ksh, here is not prompted in "/usr/bin/ksh" did not find Ksh, first determine whether the system has installed Ksh. The redhat6.5 of my system, is the installation of Ksh

which Ksh/bin/ksh

Since there is ksh, you do not have to install, directly modify the Nmonchart shell, edit Nmonchart file Vi/home/nmon/nmonchart31/nmonchart, modify the first line #!/usr/bin/ksh for #!/bin /ksh. And then execute the conversion command.

Supposedly open HTML documents, you can see the official offer of such a diagram

But when I open it, it's like this ... The above button can not be opened to see the image, think it is the reason for the browser, try Chrome, Firefox, ie are not so. Can't fix it, put it on hold, and think about what went wrong.

(4.2) Generating graphics using Nmon_analyser

Nmon Analyser is an Excel tool for: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power+Systems/ Page/nmon_analyser.

After the download decompression, there are 2 files, Word document is Analyser User Guide, the use of the analyser tool is very detailed, Excel is the tool we use to do data analysis.

When you first use it, you are generally prompted to "macros are disabled" and we need to enable macros

Then click on the "Analyze nmon Data" button, the need to analyze the *.nmon file loaded into Excel, after the analysis is completed, will generate a new Excel, which records the server parameters information, we simply look at a few graphs:

Figure 1:sys_summ. This diagram is a statistic of the CPU and I/O of the server over a period of time

Figure 2:disk_summ. This graph reflects the read and write speed of the disk and the number of I/O requests

Figure 3:cpu_all. Feedback on the load of the CPU

Figure 4:cpu_summ. Feedback on the load per core CPU over a period of time

Figure 5 Figure 6 NET. Feedback on overall network I/O conditions and I/O for each NIC

Figure 7:cpu001: Feedback on the load of the 1th-core CPU during the monitoring period (this server has 48 cores, only 1 cores are listed here)

(v) Nmon tool usage experience

Nmon tool is very small, but very powerful, nmon size less than 1MB, but can monitor more than 10 important parameters, relative to other tools, such as Iostat, top, etc., Nmon display more information, more user-friendly, as a Linux primary users, Can also understand most of the information.

Due to the poor Linux and Operating system Foundation, at present I can only understand some of the parameters, follow up also need to strengthen learning. In addition, Nmonchart has not successfully draw out graphics, also need to look for reasons.

An excellent Linux monitoring tool--nmon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.