solaris10的系统常用检查命令
转自:http://www.wzzjla.com/Html/201212/749.html
1.prtconf----print system configuration
prtconf -vp ----详细的配置信息
eg:
[root@root]:/#prtconf -vp |grep Mem
Memory size: 16376 Megabytes
[root@root]:/#prtconf | head -2
System Configuration: Sun Microsystems sun4v
Memory size: 16376 Megabytes
[root@root]:/#
2.vmstat-----report virtual memory statistics
用法:
epi Executable page-ins.
epo Executable page-outs.
epf Executable page-frees.
api Anonymous page-ins.
apo Anonymous page-outs.
apf Anonymous page-frees.
fpi File system page-ins.
fpo File system page-outs.
fpf File system page-frees.
[root@root]:/#vmstat 2 3
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m1 m1 m1 m2 in sy cs us sy id
0 0 0 29768368 10919848 25 43 19 147 147 0 0 0 0 0 0 3423 106116 3359 6 3 92
0 0 0 29418840 11055544 4 10 0 0 0 0 0 0 0 0 0 4643 103693 4439 3 1 96
0 0 0 29418520 11055312 0 1 0 0 0 0 0 0 0 0 0 4617 103677 4428 3 1 96
[root@root]:/#vmstat epi
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr -- -- -- -- in sy cs us sy id
0 0 0 29768368 10919848 25 43 19 147 147 0 0 0 0 0 0 3423 106116 3359 6 3 92
[root@root]:/#vmstat
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr m1 m1 m1 m2 in sy cs us sy id
0 0 0 29768360 10919848 25 43 19 147 147 0 0 0 0 0 0 3423 106116 3359 6 3 92
[root@root]:/#vmstat fpf
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr -- -- -- -- in sy cs us sy id
0 0 0 29768360 10919848 25 43 19 147 147 0 0 0 0 0 0 3423 106116 3359 6 3 92
[root@root]:/#
具体用法参见:
procs or kthr/r: Run queue length.
procs or kthr/b: Processes blocked while waiting for I/O.
procs or kthr/w: Idle processes which have been swapped.
memory/swap: Free, unreserved swap space (Kb).
memory/free: Free memory (Kb). (Note that this will grow until it reaches lotsfree, at which point the page scanner is started. See "Paging" for more details.)
page/re: Pages reclaimed from the free list. (If a page on the free list still contains data needed for a new request, it can be remapped.)
page/mf: Minor faults (page in memory, but not mapped). (If the page is still in memory, a minor fault remaps the page. It is comparable to the vflts value reported by sar -p.)
page/pi: Paged in from swap (Kb/s). (When a page is brought back from the swap device, the process will stop execution and wait. This may affect performance.)
page/po: Paged out to swap (Kb/s). (The page has been written and freed. This can be the result of activity by the pageout scanner, a file close, or fsflush.)
page/fr: Freed or destroyed (Kb/s). (This column reports the activity of the page scanner.)
page/de: Freed after writes (Kb/s). (These pages have been freed due to a pageout.)
page/sr: Scan rate (pages). Note that this number is not reported as a "rate," but as a total number of pages scanned.
disk/s#: Disk activity for disk # (I/O's per second).
faults/in: Interrupts (per second).
faults/sy: System calls (per second).
faults/cs: Context switches (per second).
cpu/us: User CPU time (%).
cpu/sy: Kernel CPU time (%).
cpu/id: Idle + I/O wait CPU time (%).
3.sar-----system activity reporter
用法:
sar [-aAbcdgkmpqruvwy] [-o filename] t [n]
sar [-ubdycwaqvmpgrkA] [-s hh:mm][-e hh:mm][-i ss][-f file]
eg:
[root@root]:/#sar 3 5
SunOS root 5.10 Generic_142909-17 sun4v 12/03/2012
06:13:37 %usr %sys %wio %idle
06:13:40 3 1 0 96
06:13:44 3 1 0 96
06:13:47 3 1 0 96
06:13:50 3 1 0 96
06:13:53 3 1 0 96
Average 3 1 0 96
[root@root]:/#sar -k 1 5
SunOS root 5.10 Generic_142909-17 sun4v 12/03/2012
06:13:59 sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail
06:14:00 145441920 109062696 0 921534464 807430736 0 157818880 0
06:14:01 145441920 109060328 0 921534464 807383880 0 157818880 0
06:14:02 145441920 109060936 0 921534464 807387080 0 157818880 0
06:14:03 145441920 109061080 0 921534464 807380056 0 157818880 0
06:14:05 145441920 109058288 0 921534464 807379496 0 157818880 0
Average 145441920 109060656 0 921534464 807392256 0 157818880 0
[root@root]:/#
4.swap----swap administrative interface
[root@root]:/#swap --help
swap: illegal option -- help
Usage: swap -l
swap -s
swap -d <file name> [low block]
swap -a <file name> [low block] [nbr of blocks]
[root@root]:/#swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d20 85,20 16 40968560 40968560
[root@root]:/#swap -s
total: 3744304k bytes allocated + 259816k reserved = 4004120k used, 29420120k available
5.ps----report process status
进程的内存也可分为2种,虚拟内存使用和物理内存使用。进程虚拟内存是指已经分配给进程的虚拟地址空间(virtual address space);物理内存是指分配给进程的真实的物理内存(real physical memory pages)数量。
(Ps的vsz表示虚拟内存,rss表示物理内存)
[root@root]:/#ps -opid,vsz,rss,args
PID VSZ RSS COMMAND
1724 5048 3344 -bash
2235 3440 1832 ps -opid,vsz,rss,args
[root@root]:/#
用PS命令的-o选项来实现,这些选项有:user ruser group rgroup uid ruid gid rgid pid ppid pgid sid taskid ctid pri opri pcpu pmem vsz rss osz nice class time etime stime zone zoneid f s c lwp nlwp psr tty addr wchan fname comm args projid project pset
具体的意思可以man ps来查看。
查看solaris内存使用情况,按占用内存大小排序
[root@root]:/#ps -efo pmem,uid,pid,ppid,pcpu,comm | sort -r
6.echo ::memsta
[root@root]:/#echo ::memstat | mdb -k
Page Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 117426 917 6%
Anon 470333 3674 23%
Exec and libs 27313 213 1%
Page cache 63492 496 3%
Free (cachelist) 216855 1694 11%
Free (freelist) 1162244 9080 56%
Total 2057663 16075
Physical 2038308 15924
[root@root]:/#
具体解释:
Kernel: Kernel pages
Anon: anonymous pages (such as stack, heap, shared mem etc)
Exec and libs: executables and libraries
Page cache: file cache
Free (cachelist) + Free (freelist) = freemem(vmstat 中的free值)
此命令运行起来时间比较长。
7.prstat----report active process statistics
[root@root]:/#prstat -a
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
27723 sapi 8736K 5840K cpu1 30 0 145:04:55 3.1% BMCMM/25
988 sapi 19M 13M sleep 59 0 0:01:28 0.1% Master/521
2505 sapi 15M 10M sleep 59 0 0:00:01 0.1% SegmentServer/520
14487 sapi 13M 10M sleep 59 0 0:41:47 0.0% BMCI/78
1238 sapi 12M 9536K sleep 59 0 0:00:34 0.0% BMCI/75
2528 root 5632K 4024K cpu27 59 0 0:00:00 0.0% prstat/1
7177 sapi 27M 18M sleep 59 0 0:11:32 0.0% SRAgent/251
27729 sapi 75M 46M sleep 59 0 0:59:42 0.0% MOAgent/288
27727 sapi 88M 45M sleep 59 0 0:52:14 0.0% MTAgent/187
1860 sapi 11M 8824K sleep 59 0 0:00:08 0.0% EXAgent/146
26844 sapi 407M 319M sleep 59 0 0:37:14 0.0% java/72
27410 sapi 10M 7096K sleep 59 0 0:31:13 0.0% BillGather/108
2521 oracle 2681M 2545M sleep 59 0 0:00:00 0.0% oracle/1
27738 sapi 12M 8912K sleep 59 0 0:33:09 0.0% DSMPAgent/133
5713 oracle 2683M 2547M sleep 59 0 0:06:50 0.0% oracle/1
27741 sapi 8080K 5376K sleep 59 0 0:10:49 0.0% SeqServer/10
2360 sapi 5208K 3184K sleep 59 0 0:00:00 0.0% bash/1
7641 oracle 2689M 2551M sleep 49 0 0:22:11 0.0% oracle/1
5678 oracle 290M 191M sleep 29 10 0:15:00 0.0% java/27
1696 noaccess 153M 78M sleep 59 0 0:21:01 0.0% java/18
7645 oracle 2681M 2543M sleep 59 0 0:25:23 0.0% oracle/1
673 root 6472K 2912K sleep 59 0 0:00:17 0.0% syslogd/16
1261 sapi 5208K 3184K sleep 59 0 0:00:00 0.0% bash/1
682 root 5288K 1936K sleep 59 0 0:00:00 0.0% vold/4
459 root 2928K 992K sleep 59 0 0:00:00 0.0% ttymon/1
456 root 1720K 1008K sleep 59 0 0:00:03 0.0% utmpd/1
483 root 5048K 928K sleep 59 0 0:00:00 0.0% bash/1
504 root 13M 5080K sleep 59 0 0:00:16 0.0% inetd/4
385 daemon 2792K 552K sleep 60 -20 0:00:00 0.0% lockd/2
317 daemon 3264K 968K sleep 59 0 0:00:00 0.0% rpcbind/1
NPROC USERNAME SWAP RSS MEMORY TIME CPU
65 sapi 788M 760M 4.6% 149:53:19 3.5%
55 root 100M 113M 0.7% 1:48:54 0.0%
29 oracle 2923M 3186M 19% 2:02:45 0.0%
1 noaccess 144M 115M 0.7% 0:21:01 0.0%
1 smmsp 2152K 9688K 0.1% 0:00:08 0.0%
6 daemon 9896K 12M 0.1% 0:01:04 0.0%
Total: 157 processes, 3401 lwps, load averages: 1.33, 1.29, 1.27
[root@root]:/#
用法说明:
*PID :进程的进程 ID。
*USERNAME :真实用户(登录)名称或真实用户 ID。
*SIZE :进程的总虚拟内存大小,以 K、M 或 G 为单位。
*RSS :进程的驻留集大小 (RSS),以 K、M 或 G 为单位。(RSS是进程驻留内存的大小,SIZE是进
程总共的大小。一般SIZE要大于RSS,至于SIZE大于RSS的部分就放到了SWAP区里了)
*STATE :进程的状态 (cpuN/sleep/wait/run/zombie/stop)。
*PRI :进程的优先级。数字更大表示优先级更高。
*NICE :优先级计算中使用的 nice 值。只有特定调度类中的进程才有 nice 值。
*TIME :进程的累计执行时间。
*CPU :进程使用的当前 CPU 时间的百分比。如果在非全局域中执行并且池设备是活动的,百分比将
zone绑定的池所使用的处理器集合中处理器的百分比。
*PROCESS :进程的名称(执行文件的名称)。
*NLWP :进程中 lwps 的数量
中间还有个参数:系统平均负载(Load average)在Linux系统中,uptime、w、top等命令都会有系统平均负载load average的输出.
命令输出的最后内容表示在过去的1、5、15分钟内运行队列中的平均进程数量。 只要每个CPU的当前活动进程数不大于3那么系统的性能就是良好的,如果每个CPU的任务数大于5,那么就表示这台机器的性能有严重问题。load average/cpu_num< 3 就是性能不错的。
顺便提一下,多个CPU状态查看命令:mpstat
8.top solaris默认没有安装,手动安装
作用为动态查看内存,cpu的使用率变化等。
9.mpstat----report per-processor or per-processor-set statistics
[root@root]:/#mpstat
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 1 0 55 269 29 76 0 2 148 0 941 2 2 0 97
1 3 0 108 190 78 210 1 6 506 0 5090 10 5 0 86
2 1 0 26 110 45 109 1 4 376 0 1987 5 3 0 92
3 0 0 19 54 20 54 0 2 251 0 1669 4 2 0 94
4 0 0 18 31 10 31 0 1 220 0 746 2 1 0 97
5 1 0 34 64 24 67 0 2 221 0 1465 3 2 0 95
6 3 0 109 197 81 217 1 7 578 1 5213 10 5 0 85
7 1 0 30 119 48 118 1 4 473 0 2280 5 3 0 92
8 1 0 14 58 23 57 0 3 346 0 1446 3 2 0 95
9 0 0 6 24 9 23 0 1 174 0 639 2 1 0 97
10 0 0 28 46 18 52 0 1 180 0 2514 4 2 0 94
11 4 0 120 186 76 213 2 7 596 1 12343 17 7 0 77
12 5 0 111 234 97 254 1 9 565 1 5907 10 5 0 84
13 1 0 22 139 60 137 1 5 416 0 2325 5 3 0 92
14 0 0 7 60 26 58 0 2 194 0 887 2 1 0 96
15 0 0 14 38 16 39 0 1 169 0 1408 3 1 0 96
16 1 0 23 80 33 83 0 2 145 0 713 2 1 0 97
17 3 0 122 218 89 246 1 8 388 1 2578 7 4 0 89
18 1 0 25 138 65 126 0 4 257 0 1238 3 2 0 95
19 0 0 25 98 68 51 0 2 144 0 666 2 1 0 97
20 0 0 3 15 6 14 0 1 168 0 496 1 1 0 98
21 1 0 21 47 19 49 0 1 120 0 2653 3 1 0 95
22 4 0 98 165 67 187 2 6 521 1 15703 19 6 0 75
23 1 0 18 101 43 100 1 4 404 0 2796 6 3 0 91
24 1 0 12 49 19 48 0 3 356 0 1715 4 2 0 95
25 0 0 6 22 8 21 0 1 169 0 812 2 1 0 97
26 1 0 15 34 14 36 0 1 149 0 2154 3 1 0 96
27 4 0 119 184 75 211 2 7 598 1 14969 19 7 0 74
28 4 0 108 226 94 246 1 9 576 1 7732 12 5 0 83
29 1 0 22 137 59 135 1 5 416 0 2172 5 3 0 92
30 0 0 7 59 26 57 0 2 196 0 1171 3 1 0 96
31 0 0 10 34 14 35 0 1 175 0 1681 3 1 0 96
[root@root]:/#
10.iostat
iostat - report I/O statistics
[root@root]:/#iostat 2 5
tty md10 md11 md12 md20 cpu
tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id
0 71 0 0 12 0 0 11 0 0 12 0 0 7 6 3 0 92
0 878 0 1 28 0 1 9 0 1 12 0 0 0 6 1 0 93
0 799 0 0 0 0 0 0 0 0 0 0 0 0 6 1 0 93
0 799 0 0 0 0 0 0 0 0 0 0 0 0 6 1 0 93
0 799 1 1 27 1 1 13 1 1 12 0 0 0 6 1 0 93
[root@root]:/#
终端 设备类型
tin 终端输入队列中的字符数
tout 终端输出队列中的字符数
磁盘 设备类型
bps 每秒块数
tps 每秒事务数
serv 平均服务时间,以毫秒为单位
CPU 设备类型
us 在用户模式下
sy 在系统模式下
wt 等待 I/O
id 空闲