AIX下用nmon進行監控和分析實戰

AIX下用nmon進行監控和分析實戰

nmon從這裏下載:

http://www.ibm.com/developerworks/wikis/display/Wikiptype/nmonanalyser

1、準備:

1)用root用戶登錄到系統中

2)建目錄:#mkdir /nmon/script

3)確定版本:#oslevel,以便確定用哪個腳本,我是用530

# oslevel -s

5300-09-01-0847

4)把nmon12e_aix530用ftp上傳到/nmon/script

5)執行授權命令:#chmod +x nmon12e_aix530

2、使用:

1)直接使用:

./nmon/nmon12e_aix536 -f -N -m /nmon/log -s 30 -c 2880

表示:

-f 按標準格式輸出文件:_YYYYMMDD_HHMM.nmon

-N include NFS sections

-m 切換到路徑去保存日誌文件

-s 每隔n秒抽樣一次,這裏爲30

-c 取出多少個抽樣數量,這裏爲2880,即監控=2880*(30/60/60)=24小時

根據小時計算這個數字的公式爲:c=h*3600/s,比如要監控10小時,每隔30秒採樣一次,則c=10*3600/30=1200

2)用crontab定期使用:

A、執行命令:#crontab -e

B、在最後一行添加如下命令:

0 8 * * 1,2,3,4,5 /nmon/script/nmon12e_aix530 -f -N -m /nmon/log -s 30 -c 1200

表示:

週一到週五,從早上08點開始,監控10個小時(到18:00整爲止),輸出到/nmon/log

3、分析

1)會在/tmp/nmon生成*.nmon的文件把它下載到你的電腦上

2)打開nmon analyser v339.xls,把宏的安全性設成最低,打開下載好的*.nmon文件。

並且保存爲一個文件,生成的是視圖模式的,非常直觀!

nmon.jpg

參考:

附錄一:crontab參數:

參考:http://tech.ddvip.com/2008-11/122629526990895.html

f1 f2 f3 f4 f5 program

minute hour day_of_month month weekday command這些字段接收以下值:

minute 0 到 59

hour 0 到 23

day_of_month 1 到 31

month 1 到 12

weekday 0 到 6(星期天到星期六)

其中f1 是表示分鐘,f2 表示小時,f3 表示一個月份中的第幾日,f4 表示月份,f5 表示一個星期中的第幾天。program 表示要執行的程序。

當 f1 爲 * 時表示每分鐘都要執行 program,f2 爲 * 時表示每小時都要執行程序,其餘類推

當 f1 爲 a-b 時表示從第 a 分鐘到第 b 分鐘這段時間內要執行,f2 爲 a-b 時表示從第 a 到第 b 小時都要執行,其餘類推

當 f1 爲 */n 時表示每 n 分鐘個時間間隔執行一次,f2 爲 */n 表示每 n 小時個時間間隔執行一次,其餘類推

當 f1 爲 a, b, c,... 時表示第 a, b, c,... 分鐘要執行,f2 爲 a, b, c,... 時表示第 a, b, c...個小時要執行,其餘類推

附錄二:nmon參數:

參考http://www.ibm.com/developerworks/wikis/display/Wikiptype/nmonanalyser

nmon:

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

Output file is _YYYYMMDD_HHMM.nmon

-F same as -f but user supplied filename

-c number of snapshots

-d requests disk service and wait times (DISKSERV and DISKWAIT)

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

-g file containing disk group definitions

-l number of hdisks per sheet - defaults to 150, maximum 250. See notes

-m

NMON changes to this directory before saving the file

-r goes into spreadsheet file [default hostname]

-s interval between snap shots

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

-t include top processes in the output

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

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

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

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

-J prevents JFS sections being produced (prevents Excel errors 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

-Y include SUMMARY section (very efficient alternative to –t if PID level data is not required)

example: nmon_aix51 -F asterix.nmon -r Test1 -s6 -c12

posted on 2009-02-19 20:24 IT進行時 閱讀(4975) 評論(4) 編輯 收藏

評論

# re: AIX下用nmon進行監控和分析實戰 2009-03-25 15:46 無名網

寫得不錯,很多的文章一樣的問題那就是沒有說當nmon收到參數以的都是以daemon的形式運行的。開始的時候我就認爲他沒有工作,後來對產生的文件進行監控才發一它是以daemon的形式運行的。 回覆 更多評論

下面是cronatab 服務的man :

Examples

1 To copy a file called mycronjobs into the /var/spool/cron/crontabs directory, enter the following:

crontab mycronjobs

The file will be copied as:

/var/spool/cron/crontabs/

where is your current user name.

2 To write the time to the console every hour on the hour, enter:

0 * * * * echo The hour is `date` .

>/dev/console

3 To run the calendar command at 6:30 a.m. every Monday, Wednesday, and Friday, enter:

30 6 * * 1,3,5 /usr/bin/calendar

4 To run the calendar command every day of the year at 6:30, enter the following:

30 6 * * * /usr/bin/calendar

5 To run a script called maintenance every day at midnight in August, enter the following:

0 0 * 8 * /u/harry/bin/maintenance

6 To define text for the standard input to a command, enter:

0 16 * 12 5 /usr/sbin/wall%HAPPY HOLIDAY!%Remember to

turn in your time card.

The text following the % (percent sign) defines the standard input to the wall command as:

HAPPY HOLIDAY!

Remember to turn in your time card.

http://tech.ddvip.com/2008-11/122629526990895.html

名稱 : crontab

使用權限 : 所有使用者

使用方式 :

crontab [ -u user ] file

crontab [ -u user ] { -l | -r | -e }

說明 :

crontab 是用來讓使用者在固定時間或固定間隔執行程序之用,換句話說,也就是類似使用者的時程表。-u user 是指設定指定 user 的時程表,這個前提是你必須要有其權限(比如說是 root)才能夠指定他人的時程表。如果不使用 -u user 的話,就是表示設定自己的時程表。

參數 :

crontab -e : 執行文字編輯器來設定時程表,內定的文字編輯器是 VI,如果你想用別的文字編輯器,則請先設定 VISUAL 環境變數來指定使用那個文字編輯器(比如說 setenv VISUAL joe)

crontab -r : 刪除目前的時程表

crontab -l : 列出目前的時程表

crontab file [-u user]-用指定的文件替代目前的crontab。

時程表的格式如下 :

f1 f2 f3 f4 f5 program

其中 f1 是表示分鐘,f2 表示小時,f3 表示一個月份中的第幾日,f4 表示月份,f5 表示一個星期中的第幾天。program 表示要執行的程序。

當 f1 爲 * 時表示每分鐘都要執行 program,f2 爲 * 時表示每小時都要執行程序,其餘類推

當 f1 爲 a-b 時表示從第 a 分鐘到第 b 分鐘這段時間內要執行,f2 爲 a-b 時表示從第 a 到第 b 小時都要執行,其餘類推

當 f1 爲 */n 時表示每 n 分鐘個時間間隔執行一次,f2 爲 */n 表示每 n 小時個時間間隔執行一次,其餘類推

當 f1 爲 a, b, c,... 時表示第 a, b, c,... 分鐘要執行,f2 爲 a, b, c,... 時表示第 a, b, c...個小時要執行,其餘類推

使用者也可以將所有的設定先存放在檔案 file 中,用 crontab file 的方式來設定時程表。

例子1 :

Quote:#每天早上7點執行一次 /bin/ls :

0 7 * * * /bin/ls

在 12 月內, 每天的早上 6 點到 12 點中,每隔3個小時執行一次 /usr/bin/backup :

0 6-12/3 * 12 * /usr/bin/backup

週一到週五每天下午 5:00 寄一封信給 [email protected] :

0 17 * * 1-5 mail -s "hi" [email protected] < /tmp/maildata

每月每天的午夜 0 點 20 分, 2 點 20 分, 4 點 20 分....執行 echo "haha"

20 0-23/2 * * * echo "haha"

注意 :

當程序在你所指定的時間執行後,系統會寄一封信給你,顯示該程序執行的內容,若是你不希望收到這樣的信,請在每一行空一格之後加上 > /dev/null 2>&1 即可

例子2 :

Quote:#每天早上6點10分

10 6 * * * date

#每兩個小時

0 */2 * * * date

#晚上11點到早上8點之間每兩個小時,早上8點

0 23-7/2,8 * * * date

#每個月的4號和每個禮拜的禮拜一到禮拜三的早上11點

0 11 4 * mon-wed date

#1月份日早上4點

0 4 1 jan * date

執行步驟如下:

Quote:crontab -e

添加如下內容

0 0 * * * /nmon/nmon.ksh

在nmon目錄下創建nmon.ksh文件,用vi編輯器編輯

Quote:cd /nmon/

/nmon/nmon_aix53 -fdt -s 90 -c 960


****************************************************************************************************************************************************************************************************************************

lsvg rootvg


lsvg -l rootvg


lsvg -p rootvg


-----------------------

smitty mklv 創建saloglv


smitty fs  掛載saloglv到/salog,並在salog目錄下mkdir nmonlog


AIX6.1以上自帶nmon監控

0 0 * * * /usr/bin/topas_nmon -f -x -m /salog/nmonlog >/dev/null 2>&1


AIX5.3

cd /salog

chmod 755 nmon_aix53

0 0 * * * /salog/nmon_aix53 -f -x -mm /salog/nmonlog >/dev/null 2>&1








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章