Use NMON to monitor and analyze system performance under Linux

1. Download nmon.

Choose to download the corresponding version according to the type of CPU:

http://nmon.sourceforge.net/pmwiki.php?n=Site.Download
wget  http://sourceforge.net/projects/nmon/files/download/nmon_x86_12a.zip/ download


二.初始化nmon工具。

#unzip nmon_x86_12a.zip

Archive:  nmon_x86_12a.zip
  inflating: nmon_x86_rhel45
  inflating: nmon_x86_rhel52
  inflating: nmon_x86_sles9
  inflating: nmon_x86_sles10
  inflating: nmon_x86_ubuntu810
  inflating: nmon_x86_fedora10
  inflating: nmon_x86_opensuse10


According to different platforms, initialize the nmon tool of the corresponding platform:

chmod +x nmon_x86_ubuntu810
mv nmon_x86_ubuntu810 /usr/local/bin/nmon


For Debian also do the following (works without it):

apt-get install lsb-release
lsb_release -d | sed 's/Description:\t//' > /etc/debian_release


Then run nmon directly. Running nmon directly
can monitor the usage of system resources in real time. Perform the following steps to display a report on system resource consumption for a period of time .

The following is a screenshot of the real-time monitoring of system resource consumption by directly executing the nmon command:

The consumption of CPU, memory, disk and network is displayed intuitively.

3. Generate nmon report.

1). Collect data:
#nmon -s10 -c60 -f -m /home/

Parameter explanation:
-s10 Collect data every 10 seconds.
-c60 Collect 60 times, that is, collect ten minutes of data.
-f Generated data file names include the time the file was created.
-m The storage directory of the generated data files.

This will generate an nmon file and update it every ten seconds until ten minutes later.
The generated file name is: _090824_1306.nmon, "" is the host name of this host.

nmon -h查看更多帮助信息。

2).生成报表:

下载 nmon analyser (生成性能报告的免费工具):
https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power%20Systems/page/nmon_analyser


   将之前生成的 nmon 数据文件传到 Windows 机器上,用 Excel 打开分析工具 nmon analyser v33C.xls 。点击 Excel 文件中的 "Analyze nmon data" 按钮,选择 nmon 数据文件,这样就会生成一个分析后的结果文件: hostname_090824_1306.nmon.xls ,用 Excel 打开生成的文件就可以看到结果了。

如果宏不能运行,需要做以下操作:
工具 -> 宏 -> 安全性 -> 中,然后再打开文件并允许运行宏。


下面是在测试环境中生成的NMON报告截图:

红色区域为不同指标的分析报告。

3).自动按天采集数据:

在 crontab 中增加一条记录:
0 0 * * * root nmon -s300 -c288 -f -m /home/ > /dev/null 2>&1

300*288=86400 秒,正好是一天的数据。


参考文章

nmon 性能:分析 AIX 和 Linux 性能的免费工具:
http://www.ibm.com/developerworks/cn/aix/library/analyze_aix/index.html

nmon analyser —— 生成 AIX 性能报告的免费工具:
http://www.ibm.com/developerworks/cn/aix/library/nmon_analyser/index.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326966467&siteId=291194637