linux网络监控命令 linux监控系统命令

几个常用的linux性能监控命令1. sar
每两秒刷新一次,总共5次
[root@dbhost01 ~]# sar 2 5
Linux 2.6.32-504.el6.x86_64 (dbhost01)03/30/2018_x86_64_ (4 CPU)
02:53:15 PMCPU%user%nice%system%iowait%steal%idle
02:53:17 PMall0.660.001.720.660.0096.96
02:53:19 PMall1.340.003.350.800.0094.51
02:53:21 PMall0.790.001.591.450.0096.17
02:53:23 PMall0.400.002.000.800.0096.80
02:53:25 PMall0.660.001.850.790.0096.70
Average:all0.770.002.100.900.0096.23
2. top
top -a 按照内存降序
[root@dbhost01 ~]# top -a
top - 15:00:54 up6:04,1 user,load average: 0.31, 0.19, 0.11
Tasks: 306 total,1 running, 305 sleeping,0 stopped,0 zombie
Cpu(s):7.8%us,2.4%sy,0.0%ni, 88.9%id,0.8%wa,0.0%hi,0.1%si,0.0%st
Mem:4048972k total,3848576k used,200396k free,134844k buffers
Swap:4194300k total,1788k used,4192512k free,1835360k cached
3. vmstat
vmstat用于显示虚拟内存,内核线程,磁盘,系统进程,CPU活动等统计信息 。
需要安装sysstat工具 。
[root@dbhost01 ~]# vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
rbswpdfreebuffcachesisobiboincs us sy id wa st
201788 202508 135064 18359200032269627612 9510
[root@dbhost01 ~]#
[root@dbhost01 ~]# vmstat 2 5
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
rbswpdfreebuffcachesisobiboincs us sy id wa st
001788 202336 135068 18360000032269727612 9510
001788 202624 135068 1836000002529 4012 668201 9810
001788 202624 135072 1836004005787 4003 668501 9810
101788 202508 135072 1836004005733 4402 735311 9800
001788 202540 135076 1836004003347 4002 667401 9810
4. lsof(list open files)
[root@dbhost01 ~]# lsof | grep 1521
certmonge2348root16rFIFO0,80t015212 pipe
certmonge2348root18rFIFO0,80t015218 pipe
gipcd.bin2754grid109uunix 0xffff8801391521800t036936 socket
5. tcpdump
tcpdump -i eth1
15:24:28.777779 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.777809 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393080:393596, ack 105, win 148, options [nop,nop,TS val 22996360 ecr 2443327], length 516
15:24:28.778976 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779011 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393596:393968, ack 105, win 148, options [nop,nop,TS val 22996361 ecr 2443327], length 372
15:24:28.779013 IP 192.168.2.82.50990dbhost01.ssh: Flags [.], ack 393968, win 16652, options [nop,nop,TS val 2443327 ecr 22996360], length 0
15:24:28.779481 IP dbhost02-priv.23602dbhost01-priv.24271: UDP, length 556
15:24:28.779585 IP dbhost01-priv.24271dbhost02-priv.23602: UDP, length 80
15:24:28.779909 IP dbhost01-priv.24271dbhost02-priv.23602: UDP, length 80
15:24:28.780584 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780590 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 393968:394724, ack 105, win 148, options [nop,nop,TS val 22996362 ecr 2443327], length 756
15:24:28.780820 IP dbhost01-priv.24271dbhost02-priv.23602: UDP, length 556
15:24:28.782232 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
15:24:28.782235 IP dbhost01.ssh192.168.2.82.50990: Flags [P.], seq 394724:395176, ack 105, win 148, options [nop,nop,TS val 22996364 ecr 2443327], length 452
6.netstat
[root@dbhost01 ~]# netstat -a | grep oracle
unix2[ ACC ]STREAMLISTENING31861/var/tmp/.oracle/ora_gipc_sdbhost01gridmyracdb-clusterCRFM_SIPC
unix2[ ACC ]STREAMLISTENING33820/var/tmp/.oracle/sdbhost01DBG_LOGD

推荐阅读