IBM系统监控⼯具nmon命令详解(2)!⾸先看看nmon命令的帮助信息:
[root@linux nmon]# ./nmon.sh -h
Hint: nmon.sh [-h] [-s <conds>] [-c <count>] [-f -d <disks> -t -r <name>] [-x]
-h 查看完整的说明信息,有两种模式:a、命令⾏交互式模式 (h) b、对于数据收集模式 (-f)
-f 电⼦表格的输出格式 [注意:默认 -s300 -c288] 可选 (300秒*288次=86400秒=60*60*24=1天)
-s <conds> 刷新屏幕频率的时间 [默认 2]
-c <number> 刷新屏幕的次数 [默认 1000000]
-d <disks> to increa the number of disks [default 256]
-t spreadsheet includes top process
-x capacity planning (每15分钟1天 = -fdt -s 900 -c 96)
版本 - nmon 14g
对于命令⾏交互式模式
-s <conds> 刷新屏幕频率的时间 [默认 2]
-c <number> 刷新屏幕的次数 [默认 1000000]
-g <filename> Ur Defined Disk Groups [hit g to show them]
- file = on each line: group_name <disks list> space parated
- like: databa sdb sdc sdd sde
- upto 64 disk groups, 512 disks per line
- disks can appear more than once and in many groups
-b 命令⾏交互模式的界⾯是⿊⾊和⽩⾊ [默认的颜⾊]
例如: nmon.sh -s 1 -c 100 (说明:在命令⾏交互模式下,每秒钟刷新⼀次屏幕,总共采集100次)
对于数据收集模式 = 电⼦表格格式(逗号分隔值)
Note: u only one of f,F,z,x or X and make it the first argument
-f 电⼦表格输出格式 [注意: default -s300 -c288]
输出⽂件是 <hostname>_
-F <filename> 等同于 -f 但是使⽤⽤户提供的⽂件名
-r <runname> ⽤于电⼦表格⽂件 [default hostname]
-t include top process in the output
-T as -t plus saves command line arguments in UARG ction
-s <conds> 采集数据的时间
-c <number> 采集数据的次数
-d <disks> to increa the number of disks [default 256]
-l <dpl> disks/line default 150 to avoid spreadsheet issues. EMC=64.
-
g <filename> Ur Defined Disk Groups (e above) - e BBBG & DG lines
-N include NFS Network File System
-I <percent> Include process & disks busy threshold (default 0.1)
don't save or show proc/disk using less than this percent
-m <directory> ⽣成的数据⽂件的路径
例如:在30秒的时间间隔收集的top procs,持续1⼩时
nmon.sh -f -t -r Test1 -s30 -c120
心爱的娃娃To load into a spreadsheet:
sort -A *nmon >stats.csv
transfer the stats.csv file to your PC
Start spreadsheet & then Open type=comma-parated-value ASCII file
The nmon analyr or consolidator does not need the file sorted.
Capacity planning mode - u cron to run each day
-x nsible spreadsheet output for CP = one day
每15分钟1天 ( i.e. -ft -s 900 -c 96)
民主生活会意见-X nsible spreadsheet output for CP = busy hour
每30秒1⼩时 ( i.e. -ft -s 30 -c 120)
交互模式命令
key --- Toggles to control what is displayed ---
h = 联机帮助信息
h = 联机帮助信息
r = 机器类型,机器名,缓存信息和OS版本+LPAR
c = CPU处理器统计条形图
l = 条形图长期CPU(超过75个快照)
m = 内存统计
L = 巨⼤的内存页⾯统计
V = 虚拟内存和交换统计
k = 内核内部统计
n = ⽹络统计和错误
N = NFS⽹络⽂件系统
d = 磁盘I/O图
D = 磁盘I/O统计
o = 磁盘I/O映射(每个磁盘上的⼀个字符显⽰它是多么繁忙)
j = ⽂件系统
t = 顶级进程统计使⽤1,3,4,5来选择数据及顺序
u = 顶级进程命令的详细信息
v = 详细简单的检查 - OK/Warn(警告)/Danger(危险)
面条煮几分钟
b = ⿊⽩模式(或使⽤- b选项)
. = 最⼩模式,即只显⽰繁忙的磁盘和进程
key --- Other Controls ---
+ = 双屏幕刷新时间
- = ⼀半的屏幕刷新时间
q = 退出 (also x, e or control-C)
0 = 零峰计数复位 (峰值 = ">")
space = ⽴即刷新屏幕
Startup Control
If you find you always type the same toggles every time you start
then place them in the NMON shell variable. For example:
export NMON=cmdrvtan
Others:
a) To you want to stop nmon - kill -USR2 <nmon-pid>
b) U -p and nmon outputs the background process pid
c) To limit the process nmon lists (online and to a file)
姚宇轩
Either t NMONCMD0 to NMONCMD63 to the program names
or u -C cmd:cmd:cmd etc. example: -C ksh:vi:syncd
d) If you want to pipe nmon output to other commands u a FIFO:
mkfifo /tmp/mypipe
nmon -F /tmp/mypipe &
grep /tmp/mypipe
e) If nmon fails plea report it with:
1) nmon version like: 14g
2) the output of cat /proc/cpuinfo
3) some clue of what you were doing
4) I may ask you to run the debug version
Developer Nigel Griffiths
Feedback welcome - on the current relea only and state exactly the problem No warranty given or implied.
在操作系统下⾯输⼊如下命令就会进到nmon的监控界⾯:
[root@linux nmon]# ./nmon.sh
+nmon-14g------[H for help]---Hostname=linux--------Refresh= 2cs ---04:22.50-------------------------------------------------------------------------------------------------------| |
| ------------------------------ For help type H or ... |
| # # # # #### # # nmon -? - hint |
| ## # ## ## # # ## # nmon -h - full |
| # # # # ## # # # # # # |
| # # # # # # # # # # To start the same way every time |
| # ## # # # # # ## t the NMON ksh variable |
好听的古风名字女| # # # # #### # # |
| ------------------------------ |
| |
| U the keys to toggle statistics on/off: |
| c = CPU l = CPU Long-term - = Faster screen updates |
| m = Memory j = Filesystems + = Slower screen updates |
| d = Disks n = Network V = Virtual Memory |
| r = Resource N = NFS v = Verbo hints |
| k = kernel t = Top-process . = only busy disks/procs |
| h = more options q = Quit |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
在这⾥就可以看见⼀些指令的介绍和⼀些信息,其中 Refresh= 2cs 就是表⽰监控界⾯2秒钟刷新⼀次,也可以在nmon命令后⾯跟 -s
参数来指定想要刷新的频率,输⼊ h 可以看见更详细指令的介绍:
+nmon-14g------[H for help]---Hostname=linux--------Refresh= 2cs ---04:27.49----------------------------------------------------------------------------------------------
| HELP ------------------------------------------------------------------------------------------------------------------------------------------------ |
| key --- statistics which toggle on/off --- |
| h = This help information |
| r = RS6000/pSeries CPU/cache/OS/kernel/hostname details + LPAR |
| t = Top Process Stats 1=basic 3=CPU |
| u = shows command arguments (hit twice to refresh) |
| c = CPU by processor l = longer term CPU averages |
| m = Memory & Swap stats L=Huge j = JFS Usage Stats |
| n = Network stats N = NFS |
| d = Disk I/O Graphs D=Stats o = Disks %Busy Map |
| k = Kernel stats & loadavg V = Virtual Memory |
| g = Ur Defined Disk Groups [start nmon with -g <filename>] |
| v = Verbo Simple Checks - OK/Warnings/Danger |
| b = black & white mode |
| --- controls --- |
| + and - = double or half the screen refresh time |
| q = quit space = refresh screen now |
| . = Minimum Mode =display only busy disks and process |
| 0 = ret peak counts to zero (peak = ">") |
| Developer Nigel Griffiths e nmon.sourceforge |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
在这⾥可以看见所有输⼊的指令,以及会看到什么内容,这⾥要说⼀下在nmon中输⼊⼀次 h 会看见帮助信息,在敲⼀次 h 就会取消显⽰
了,其它指令也同理,这⾥输⼊ r (机器类型,机器名,缓存信息和OS版本+LPAR):
| Linux and Processor Details ------------------------------------------------------------------------------------------------------------------------- |
| Linux: Linux version 2.6.18-164.el5 (mockbuild@x86-002.) |
| Build: (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) |
| Relea : 2.6.18-164.el5 |
| Version : #1 SMP Tue Aug 18 15:51:54 EDT 2009 |
| cpuinfo: model name : Intel(R) Core(TM) i3-2310M CPU @ 2.10GHz |
| cpuinfo: vendor_id : GenuineIntel |
| cpuinfo: cpu MHz : 2093.260 |
| cpuinfo: bogomips : 4186.52 |
| # of CPUs: 1 --1颗cpu |
| Machine : i686 |
| Nodename : linux --hostname |
| /etc/*ea[1]: Red Hat Enterpri Linux Server relea 5.4 (Tikanga) --操作系统版本 |
| /etc/*ea[2]: (null) |
| /etc/*ea[3]: (null) |
| /etc/*ea[4]: (null) |
| lsb_relea: Distributor ID: RedHatEnterpriServer |
| lsb_relea: Description: Red Hat Enterpri Linux Server relea 5.4 (Tikanga) |
| lsb_relea: Relea: 5.4 |
| lsb_relea: Codename: Tikanga |
+---------Warning: Some Statistics may not shown----------------------------------------------------------------------------------------------------------------------------------------------
在这⾥看见⼀些主机和操作系统的信息,再敲⼀次 r 就会取消显⽰了,然后输⼊ t (顶级进程统计使⽤1,3,4,5来选择数据及顺序),然后
再按数字 5 :
| Top Process Procs=85 mode=5 (1=Basic, 3=Perf 4=Size 5=I/O)--------------------------------------------------------------------------------------------------------------
| PID %CPU Size Res Res Res Res Shared Faults Command |
| Ud KB Set Text Data Lib KB Min Maj |
| 4050 0.5 12748 10548 108 10896 0 832 84 0 nmon.sh |
| 1 0.0 2072 624 32 280 0 532 0 0 init |
| 2 0.0 0 0 0 0 0 0 0 0 migration/0 |
| 3 0.0 0 0 0 0 0 0 0 0 ksoftirqd/0 |
| 4 0.0 0 0 0 0 0 0 0 0 watchdog/0 |
| 5 0.0 0 0 0 0 0 0 0 0 events/0 |
| 6 0.0 0 0 0 0 0 0 0 0 khelper |
| 7 0.0 0 0 0 0 0 0 0 0 kthread |
| 10 0.0 0 0 0 0 0 0 0 0 kblockd/0 |
| 11 0.0 0 0 0 0 0 0 0 0 kacpid |
| 67 0.0 0 0 0 0 0 0 0 0 cqueue/0 |
北山公园| 70 0.0 0 0 0 0 0 0 0 0 khubd |
| 72 0.0 0 0 0 0 0 0 0 0 kriod |
| 136 0.0 0 0 0 0 0 0 0 0 pdflush |
林教头风雪山神庙读后感| 137 0.0 0 0 0 0 0 0 0 0 pdflush |
| 138 0.0 0 0 0 0 0 0 0 0 kswapd0 |
| 139 0.0 0 0 0 0 0 0 0 0 aio/0 |
+---------Warning: Some Statistics may not shown----------------------------------------------------------------------------------------------------------------------------------------------
注意这个 mode=5 表⽰就是按I/O来排序了,这⾥还可以选择其它(1、3、4、5)⽅式排序,这⾥可以看见系统有85个进程
(Procs=85),5就是按占⽤的cpu来排的降序,接着输⼊ u (顶级进程命令的详细信息):
| Top Process Procs=85 mode=5 (1=Basic, 3=Perf 4=Size 5=I/O)--------------------------------------------------------------------------------------------------------------
| PID %CPU ResSize Command Command |
| Ud KB |
| 4050 1.0 10660 ./nmon.sh |
| 1 0.0 624 init [3] |
| 2 0.0 0 [migration/0] |
| 3 0.0 0 [ksoftirqd/0] |
| 4 0.0 0 [watchdog/0] |
| 5 0.0 0 [events/0] |
| 6 0.0 0 [khelper] |
| 7 0.0 0 [kthread] |
| 10 0.0 0 [kblockd/0] |
| 11 0.0 0 [kacpid] |
| 67 0.0 0 [cqueue/0] |
| 70 0.0 0 [khubd] |
网络交友| 72 0.0 0 [kriod] |
| 136 0.0 0 [pdflush] |
| 137 0.0 0 [pdflush] |
| 138 0.0 0 [kswapd0] |
| 139 0.0 0 [aio/0] |
+---------Warning: Some Statistics may not shown----------------------------------------------------------------------------------------------------------------------------------------------以上信息都很直观,我就不在多说了,接着看 c (CPU处理器统计条形图):
| CPU Utilisation ------------------------------------------------------------------------------------------------------------------------------------- |
|---------------------------+-------------------------------------------------+ |
|CPU Ur% Sys% Wait% Idle|0 |25 |50 |75 100| |
| 1 0.0 0.0 0.0 100.0| > | |
|---------------------------+-------------------------------------------------+ |
|--------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------|
从上⾯可以看见系统⾮常闲(Idle=100%),其中“>”代表的是系统最⾼cpu的使⽤峰值,如果按数字0就会重置峰值为0了,接着看 l
(条形图长期CPU):
| CPU +-------------------------------------------------------------------------+ |
|100%-| | |
| 95%-| | |
| 90%-| | |
| 85%-| | |
| 80%-| | |
| 75%-| | |
| 70%-| | |
| 65%-| | |
| 60%-| | |
| 55%-| | |
| 50%-| | |
| 45%-| | |
| 40%-| | |
| 35%-| | |
| 30%-| | |
| 25%-| | |
| 20%-| | |
| 15%-| | |
| 10%-| | |
+---------Warning: Some Statistics may not shown----------------------------------------------------------------------------------------------------------------------------------------------也是cpu使⽤情况的另⼀种显⽰,其中“|”和上⾯的“>”原理⼀样,接着看 m(内存统计):