Displaying netstat statistics at various intervals


I periodically need to review netstat data to debug network problems, and prefer to view the deltas between two adjacent runs. The Solaris netstat utility can be passed a time interval, which will cause it to display the difference between two runs:

$ netstat -sP tcp 10

TCP tcpRtoAlgorithm = 4 tcpRtoMin = 400
tcpRtoMax = 60000 tcpMaxConn = -1
tcpActiveOpens = 20 tcpPassiveOpens = 50
tcpAttemptFails = 20 tcpEstabResets = 0
tcpCurrEstab = 4 tcpOutSegs =859323
tcpOutDataSegs =847791 tcpOutDataBytes =1159286456
tcpRetransSegs = 19 tcpRetransBytes = 13388
tcpOutAck = 11532 tcpOutAckDelayed = 620
tcpOutUrg = 0 tcpOutWinUpdate = 96
tcpOutWinProbe = 0 tcpOutControl = 136
tcpOutRsts = 20 tcpOutFastRetrans = 0
tcpInSegs =186702
tcpInAckSegs =103393 tcpInAckBytes =1159286502
tcpInDupAck = 229 tcpInAckUnsent = 0
tcpInInorderSegs = 83753 tcpInInorderBytes =79048288
tcpInUnorderSegs = 9 tcpInUnorderBytes = 432
tcpInDupSegs = 8 tcpInDupBytes = 4664
tcpInPartDupSegs = 0 tcpInPartDupBytes = 0
tcpInPastWinSegs = 0 tcpInPastWinBytes = 0
tcpInWinProbe = 0 tcpInWinUpdate = 0
tcpInClosed = 0 tcpRttNoUpdate = 0
tcpRttUpdate =103347 tcpTimRetrans = 109
tcpTimRetransDrop = 0 tcpTimKeepalive = 61
tcpTimKeepaliveProbe= 15 tcpTimKeepaliveDrop = 0
tcpListenDrop = 0 tcpListenDropQ0 = 0
tcpHalfOpenDrop = 0 tcpOutSackRetrans = 7


TCP tcpRtoAlgorithm = 0 tcpRtoMin = 400
tcpRtoMax = 60000 tcpMaxConn = -1
tcpActiveOpens = 0 tcpPassiveOpens = 0
tcpAttemptFails = 0 tcpEstabResets = 0
tcpCurrEstab = 4 tcpOutSegs = 83
tcpOutDataSegs = 83 tcpOutDataBytes = 6544
tcpRetransSegs = 0 tcpRetransBytes = 0
tcpOutAck = 0 tcpOutAckDelayed = 0
tcpOutUrg = 0 tcpOutWinUpdate = 0
tcpOutWinProbe = 0 tcpOutControl = 0
tcpOutRsts = 0 tcpOutFastRetrans = 0
tcpInSegs = 78
tcpInAckSegs = 76 tcpInAckBytes = 6544
tcpInDupAck = 0 tcpInAckUnsent = 0
tcpInInorderSegs = 2 tcpInInorderBytes = 96
tcpInUnorderSegs = 0 tcpInUnorderBytes = 0
tcpInDupSegs = 0 tcpInDupBytes = 0
tcpInPartDupSegs = 0 tcpInPartDupBytes = 0
tcpInPastWinSegs = 0 tcpInPastWinBytes = 0
tcpInWinProbe = 0 tcpInWinUpdate = 0
tcpInClosed = 0 tcpRttNoUpdate = 0
tcpRttUpdate = 76 tcpTimRetrans = 0
tcpTimRetransDrop = 0 tcpTimKeepalive = 0
tcpTimKeepaliveProbe= 0 tcpTimKeepaliveDrop = 0
tcpListenDrop = 0 tcpListenDropQ0 = 0
tcpHalfOpenDrop = 0 tcpOutSackRetrans = 0

Netstat is some good stuff!

This article was posted by Matty on 2006-12-26 20:53:00 -0400 -0400