Linux 下使用 NMON 分析系统性能

本文介绍如何在Linux环境下使用NMON工具进行系统性能监控与分析。内容涵盖NMON的安装配置、数据采集及利用nmonanalyser生成性能报告的过程。

Linux 下使用 NMON 分析系统性能

下载相应 CPU 类型的版本:
http://nmon.sourceforge.net/pmwiki.php?n=Site.Download

wget http://sourceforge.net/projects/nmon/files/download/nmon_x86_12a.zip/download
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

使用对应的操作系统文件:
chmod +x nmon_x86_ubuntu810
mv nmon_x86_ubuntu810 /usr/local/bin/nmon

对于 Debian 还要做以下操作(不做也同样能运行):
apt-get install lsb-release
lsb_release -d | sed 's/Description:\t//' > /etc/debian_release

然后直接运行 nmon 即可。

采集数据并生成报表:
采集数据:
nmon -s10 -c60 -f -m /home/

参数解释:
-s10 每 10 秒采集一次数据。
-c60 采集 60 次,即为采集十分钟的数据。
-f 生成的数据文件名中包含文件创建的时间。
-m 生成的数据文件的存放目录。

这样就会生成一个 nmon 文件,并每十秒更新一次,直到十分钟后。
生成的文件名如: hostname_090824_1306.nmon ,"hostname" 是这台主机的主机名。

生成报表:
下载 nmon analyser (生成性能报告的免费工具):
http://www.ibm.com/developerworks/wikis/display/Wikiptype/nmonanalyser

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

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

自动按天采集数据:
在 crontab 中增加一条记录:
0 0 * * * root nmon -s300 -c288 -f -m /home/ > /dev/null 2>&1

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

详细参数设置如下:

For spreadsheet output mode (comma separated values) use the following flags when invoking nmon:

-f              spreadsheet output format [note: default -s300 -c288]

                        Output file is <hostname>_YYYYMMDD_HHMM.nmon

             -F <filename>      same as -f but user supplied filename

-m <dir>       NMON changes to this directory before saving the file

-c <number>       number of snapshots

-s <seconds>       interval between snap shots

-x           capacity planning (15 mins for 1 day = -fdt -s900 -c96)      

-r <runname>      goes into spreadsheet file [default hostname]

        -l <dpl>        number of hdisks per sheet - defaults to 150, maximum value 250.                                   see notes

-t                      include top processes in the output

-T                      as –t plus saves command line arguments in UARG section

-I <percent>        Ignore processes using less than this amount of CPU when generating TOP section – useful for reducing data volumes

-A              include data for async I/O (PROCAIO) sections

-E              prevents ESS sections being produced (necessary when Disk Groups are being used because there are too many vpaths to process)

-D     prevents DISK sections being produced (useful when Disk Groups are being used because there are too many hdisks to process)

-g <filename>       file containing disk group definitions

-J    prevents JFS sections being produced (useful when you have more than 255 filesystems)

-L     includes LARGEPAGE section

-N     include NFS sections

-S     include WLM sections with subclasses

-W    include WLM sections without subclasses

参考资料:
nmon for Linux:
http://nmon.sourceforge.net/pmwiki.php

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值