上一篇: 專業(yè)網(wǎng)站建設(shè)網(wǎng)站:運(yùn)維監(jiān)控和排障所需要的數(shù)據(jù)

網(wǎng)站建設(shè)方法:可以忽略其他端口的連接數(shù),直接以服務(wù)器的全部連接數(shù)來進(jìn)行估算。
Foreign Address State
O.0.0.O:★
O圭27.0.0.1:8118 0.0.0.O:★
0 :'0 .-01- 0 ; 0: 2:2
0.0.0.0:★
LISTEN
LISTEN
LISTEN
■●■■■■●●■■■■■■■■■■■_
808/sshd
tcp 0
1041/cupsd
tcp 0
1196/redis-server
tcp 0
114 9/memcached
tcp6 0
808/sshd
tcp6 0
1041/cupsd
127.0.0:1:631 . . .0.0.0.0:*
127.0.0.1:6379 ' . . ' 0.0.0.0:7k
127.0.0.1:11211 0.0.0.0:*
O :::22
O ::1:631
LISTEN
LISTEN
LISTEN
LISTEN
LISTEN
netstat查看到的state是在統(tǒng)計(jì)和排障中最經(jīng)常被關(guān)心的數(shù)據(jù)。通常我們會(huì)使用如下
shell命令來計(jì)算服務(wù)器當(dāng)前的80端口網(wǎng)絡(luò)連接數(shù)。
$ netstat -tan I awk '$4~/:80$/t++state [$NF] } END { for (key in state) print
key,"\t",state [key] l'
LAST_ACK
SYN_RECV
ESTABLISHED
FIN_WAIT1
FIN_WAIT2
CLOSING
TIME WAIT
1
14
79
28
3
5
1669
不過netstat命令速度比較慢,如果服務(wù)器是單一業(yè)務(wù),則可以忽略其他端口的連接數(shù),
netstat -st I grep conn
2816395 active connections openings
541941 passive connection openings
2014738 failed connection attempts
7999 connection resets received .
40 connections established
9818 connections reset due to unexpected data
' 2372 connections reset due to early user close
4895 connections aborted due to timeout .
中已經(jīng)提到過vmstat,其輸出中除了內(nèi)存相關(guān)的數(shù)據(jù)以外,還有I/O的內(nèi)容,