來源http://hi.baidu.com/bianxuehui/item/4c6af8e8e3ca58295a7cfbf6
下載相應 CPU 類型的版本:
http://nmon.sourceforge.net/pmwiki.php?n=Site.Download
將文件放入:/root/nmon下
cd /root/nmon
tar zxvf nmon_linux_14i.tar.gz
使用對應的操作系統文件:
chmod +x nmon_x86_ubuntu810
然後直接運行 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 _YYYYMMDD_HHMM.nmon
-F same as -f but user supplied filename
-m
-c number of snapshots
-s interval between snap shots
-x capacity planning (15 mins for 1 day = -fdt -s900 -c96)
-r goes into spreadsheet file [default hostname]
-l 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 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 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