「nmon」の版間の差分
提供: Ubuntu入門
(相違点なし)
|
2014年8月16日 (土) 15:16時点における最新版
nmon とは、システムアドミニストレーター、チューナーのためのベンチマークツールです。
読み方
- nmon
- えぬもん
概要
nmon は、CPU、メモリ、ディスクI/O、ネットワークなどのシステムリソースの使用状況をリアルタイムにモニタリングできるツールです。
┌nmon─14g───────────────Hostname=ubuntu───────Refresh= 2secs ───15:06.41 ┐ │ │ │ ------------------------------ For help type H or ... │ │ # # # # #### # # nmon -? - hint │ │ ## # ## ## # # ## # nmon -h - full │ │ # # # # ## # # # # # # │ │ # # # # # # # # # # To start the same way every time │ │ # ## # # # # # ## set the NMON ksh variable │ │ # # # # #### # # │ │ ------------------------------ │ │ │ │ Use these 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 = Verbose hints │ │ k = kernel t = Top-processes . = only busy disks/procs │ │ h = more options q = Quit │ │─────────────────────────────────────────────────│ │ │ │ │ │ │ │ │ └─────────────────────────────────────────────────┘
インストール
sudo apt-get install nmon
使い方
コマンドラインオプション
Hint: nmon [-h] [-s <seconds>] [-c <count>] [-f -d <disks> -t -r <name>] [-x] -h FULL help information Interactive-Mode: read startup banner and type: "h" once it is running For Data-Collect-Mode (-f) -f spreadsheet output format [note: default -s300 -c288] optional -s <seconds> between refreshing the screen [default 2] -c <number> of refreshes [default millions] -d <disks> to increase the number of disks [default 256] -t spreadsheet includes top processes -x capacity planning (15 min for 1 day = -fdt -s 900 -c 96) Version - nmon 14g For Interactive-Mode -s <seconds> time between refreshing the screen [default 2] -c <number> of refreshes [default millions] -g <filename> User Defined Disk Groups [hit g to show them] - file = on each line: group_name <disks list> space separated - like: database sdb sdc sdd sde - upto 64 disk groups, 512 disks per line - disks can appear more than once and in many groups -b black and white [default is colour] example: nmon -s 1 -c 100 For Data-Collect-Mode = spreadsheet format (comma separated values) Note: use only one of f,F,z,x or X and make it the first argument -f spreadsheet output format [note: default -s300 -c288] output file is <hostname>_YYYYMMDD_HHMM.nmon -F <filename> same as -f but user supplied filename -r <runname> used in the spreadsheet file [default hostname] -t include top processes in the output -T as -t plus saves command line arguments in UARG section -s <seconds> between snap shots -c <number> of snapshots before nmon stops -d <disks> to increase the number of disks [default 256] -l <dpl> disks/line default 150 to avoid spreadsheet issues. EMC=64. -g <filename> User Defined Disk Groups (see above) - see 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> nmon changes to this directory before saving to file example: collect for 1 hour at 30 second intervals with top procs nmon -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-separated-value ASCII file The nmon analyser or consolidator does not need the file sorted. Capacity planning mode - use cron to run each day -x sensible spreadsheet output for CP = one day every 15 mins for 1 day ( i.e. -ft -s 900 -c 96) -X sensible spreadsheet output for CP = busy hour every 30 secs for 1 hour ( i.e. -ft -s 30 -c 120) Interactive Mode Commands key --- Toggles to control what is displayed --- h = Online help information r = Machine type, machine name, cache details and OS version + LPAR c = CPU by processor stats with bar graphs l = long term CPU (over 75 snapshots) with bar graphs m = Memory stats L = Huge memory page stats V = Virtual Memory and Swap stats k = Kernel Internal stats n = Network stats and errors N = NFS Network File System d = Disk I/O Graphs D = Disk I/O Stats o = Disk I/O Map (one character per disk showing how busy it is) o = User Defined Disk Groups j = File Systems t = Top Process stats use 1,3,4,5 to select the data & order u = Top Process full command details v = Verbose mode - tries to make recommendations b = black and white mode (or use -b option) . = minimum mode i.e. only busy disks and processes key --- Other Controls --- + = double the screen refresh time - = halves the screen refresh time q = quit (also x, e or control-C) 0 = reset peak counts to zero (peak = ">") space = refresh screen now 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) Use -p and nmon outputs the background process pid c) To limit the processes nmon lists (online and to a file) Either set NMONCMD0 to NMONCMD63 to the program names or use -C cmd:cmd:cmd etc. example: -C ksh:vi:syncd d) If you want to pipe nmon output to other commands use a FIFO: mkfifo /tmp/mypipe nmon -F /tmp/mypipe & grep /tmp/mypipe e) If nmon fails please 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 release only and state exactly the problem No warranty given or implied.
コマンドの実行例
┌nmon─14g────Hostname=ubuntu───────Refresh= 2secs ───15:08.05──┐ │ CPU Utilisation ───────────────────────────────│ │---------------------------+-------------------------------------------------+ │ │CPU User% Sys% Wait% Idle|0 |25 |50 |75 100| │ │ 1 12.4 3.5 0.0 84.1|UUUUUUs > | │ │---------------------------+-------------------------------------------------+ │ │ Network I/O ─────────────────────────────────│ │I/F Name Recv=KB/s Trans=KB/s packin packout insize outsize Peak->Recv Trans │ │ eth0 0.1 0.0 1.0 0.0 92.0 0.0 2.7 0.0 │ │ lo 0.5 0.5 3.0 3.0 165.2 165.2 49.4 49.4 │ │ docker0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 │ │ Disk I/O ──/proc/diskstats────mostly in KB/s─────Warning:contains duplicates──│ │DiskName Busy Read WriteKB|0 |25 |50 |75 100| │ │sda 0% 0.0 0.0|> | │ │sda1 0% 0.0 0.0|> | │ │sda2 0% 0.0 0.0|> | │ │sda5 0% 0.0 0.0|> | │ │Totals Read-MB/s=0.0 Writes-MB/s=0.0 Transfers/sec=0.0 │ │───────────────────────────────────────│
ファイルにロギングする
- -f
- ファイルに出力する
- -s 秒数
- 秒数ごとに計測する
- -c カウント
- 何回実行するか
- -t
- トッププロセスの情報を出力する
nmon -f -s 10 -c 360 -t
-F を指定しない場合、カレントディレクトリにログファイルが作成されます。
ubuntu_140816_1511.nmon
以下の様な出力が保存されます。
$ head -100 ubuntu_140816_1511.nmon AAA,progname,nmon AAA,command,nmon -f -s 10 -c 360 -t AAA,version,14g AAA,disks_per_line,150 AAA,max_disks,256,set by -d option AAA,disks,4, AAA,host,ubuntu AAA,user,kaworu AAA,OS,Linux,3.13.0-24-generic,#47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014,x86_64 AAA,runname,ubuntu AAA,time,15:11.06 AAA,date,16-AUG-2014 AAA,interval,10 AAA,snapshots,360 AAA,cpus,1 AAA,proc_stat_variables,8 AAA,note0, Warning - use the UNIX sort command to order this file before loading into a spreadsheet AAA,note1, The First Column is simply to get the output sorted in the right order AAA,note2, The T0001-T9999 column is a snapshot number. To work out the actual time; see the ZZZ section at the end CPU001,CPU 1 ubuntu,User%,Sys%,Wait%,Idle% CPU_ALL,CPU Total ubuntu,User%,Sys%,Wait%,Idle%,Busy,CPUs MEM,Memory MB ubuntu,memtotal,hightotal,lowtotal,swaptotal,memfree,highfree,lowfree,swapfree,memshared,cached,active,bigfree,buffers,swapcached,inactive PROC,Processes ubuntu,Runnable,Blocked,pswitch,syscall,read,write,fork,exec,sem,msg NET,Network I/O ubuntu,eth0-read-KB/s,lo-read-KB/s,docker0-read-KB/s,eth0-write-KB/s,lo-write-KB/s,docker0-write-KB/s, NETPACKET,Network Packets ubuntu,eth0-read/s,lo-read/s,docker0-read/s,eth0-write/s,lo-write/s,docker0-write/s, DISKBUSY,Disk %Busy ubuntu,sda,sda1,sda2,sda5 DISKREAD,Disk Read KB/s ubuntu,sda,sda1,sda2,sda5 DISKWRITE,Disk Write KB/s ubuntu,sda,sda1,sda2,sda5 DISKXFER,Disk transfers per second ubuntu,sda,sda1,sda2,sda5 DISKBSIZE,Disk Block Size ubuntu,sda,sda1,sda2,sda5 DGBUSY,Disk Group Busy ubuntu DGREAD,Disk Group Read KB/s ubuntu DGWRITE,Disk Group Write KB/s ubuntu DGSIZE,Disk Group Block Size KB ubuntu DGXFER,Disk Group Transfers/s ubuntu JFSFILE,JFS Filespace %Used ubuntu,/,/dev,/run,/run/lock,/run/shm,/run/user,/run/vmblock-fuse,/run/user/1000/gvfs TOP,%CPU Utilisation TOP,+PID,Time,%CPU,%Usr,%Sys,Size,ResSet,ResText,ResData,ShdLib,MinorFault,MajorFault,Command BBBP,000,/etc/release BBBP,001,/etc/release,"DISTRIB_ID=Ubuntu" BBBP,002,/etc/release,"DISTRIB_RELEASE=14.04" BBBP,003,/etc/release,"DISTRIB_CODENAME=trusty" BBBP,004,/etc/release,"DISTRIB_DESCRIPTION="Ubuntu 14.04 LTS"" BBBP,005,/etc/release,"NAME="Ubuntu"" BBBP,006,/etc/release,"VERSION="14.04, Trusty Tahr"" BBBP,007,/etc/release,"ID=ubuntu" BBBP,008,/etc/release,"ID_LIKE=debian" BBBP,009,/etc/release,"PRETTY_NAME="Ubuntu 14.04 LTS"" BBBP,010,/etc/release,"VERSION_ID="14.04"" BBBP,011,/etc/release,"HOME_URL="http://www.ubuntu.com/"" BBBP,012,/etc/release,"SUPPORT_URL="http://help.ubuntu.com/"" BBBP,013,/etc/release,"BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"" BBBP,014,lsb_release BBBP,015,lsb_release,"Distributor ID: Ubuntu" BBBP,016,lsb_release,"Description: Ubuntu 14.04 LTS" BBBP,017,lsb_release,"Release: 14.04" BBBP,018,lsb_release,"Codename: trusty" BBBP,019,fdisk-l BBBP,020,/proc/cpuinfo BBBP,021,/proc/cpuinfo,"processor : 0" BBBP,022,/proc/cpuinfo,"vendor_id : GenuineIntel" BBBP,023,/proc/cpuinfo,"cpu family : 6" BBBP,024,/proc/cpuinfo,"model : 42" BBBP,025,/proc/cpuinfo,"model name : Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz" BBBP,026,/proc/cpuinfo,"stepping : 7" BBBP,027,/proc/cpuinfo,"microcode : 0x1a" BBBP,028,/proc/cpuinfo,"cpu MHz : 3411.219" BBBP,029,/proc/cpuinfo,"cache size : 8192 KB" BBBP,030,/proc/cpuinfo,"physical id : 0" BBBP,031,/proc/cpuinfo,"siblings : 1" BBBP,032,/proc/cpuinfo,"core id : 0" BBBP,033,/proc/cpuinfo,"cpu cores : 1" BBBP,034,/proc/cpuinfo,"apicid : 0" BBBP,035,/proc/cpuinfo,"initial apicid : 0" BBBP,036,/proc/cpuinfo,"fpu : yes" BBBP,037,/proc/cpuinfo,"fpu_exception : yes" BBBP,038,/proc/cpuinfo,"cpuid level : 13" BBBP,039,/proc/cpuinfo,"wp : yes" BBBP,040,/proc/cpuinfo,"flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm" BBBP,041,/proc/cpuinfo,"bogomips : 6822.43" BBBP,042,/proc/cpuinfo,"clflush size : 64" BBBP,043,/proc/cpuinfo,"cache_alignment : 64" BBBP,044,/proc/cpuinfo,"address sizes : 40 bits physical, 48 bits virtual" BBBP,045,/proc/cpuinfo,"power management:" BBBP,046,/proc/cpuinfo,"" BBBP,047,/proc/meminfo BBBP,048,/proc/meminfo,"MemTotal: 1010508 kB" BBBP,049,/proc/meminfo,"MemFree: 82560 kB" BBBP,050,/proc/meminfo,"Buffers: 21564 kB" BBBP,051,/proc/meminfo,"Cached: 203480 kB" BBBP,052,/proc/meminfo,"SwapCached: 23640 kB" BBBP,053,/proc/meminfo,"Active: 326760 kB" BBBP,054,/proc/meminfo,"Inactive: 440868 kB" BBBP,055,/proc/meminfo,"Active(anon): 216020 kB" BBBP,056,/proc/meminfo,"Inactive(anon): 340740 kB" BBBP,057,/proc/meminfo,"Active(file): 110740 kB" BBBP,058,/proc/meminfo,"Inactive(file): 100128 kB" BBBP,059,/proc/meminfo,"Unevictable: 32 kB" BBBP,060,/proc/meminfo,"Mlocked: 32 kB" BBBP,061,/proc/meminfo,"SwapTotal: 1046524 kB"