下载相应 CPU 类型的版本:
http://nmon.sourceforge.net/pmwiki.php?n=Site.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