RE: count of active tcp sockets?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



J Potter wrote:
> 
> > netstat -an|grep TIME_WAIT|wc  ?
> 
> I need to avoid anything that lists out all the connections -- the  
> above would take too long if there are tens of thousands of 
> connections.
> 
> I'm hoping there's a proc entry that has a summary count of the  
> current number of connections?

With the -n added to the option it won't resolve IPs so it
shouldn't take that long, but otherwise:

cat /proc/net/sockstat
sockets: used 284
TCP: inuse 16 orphan 0 tw 0 alloc 18 mem 1
UDP: inuse 12
RAW: inuse 1
FRAG: inuse 0 memory 0

I believe the tw is the time_wait count, just:

awk '/TCP:/ {print $7}' /proc/net/sockstat

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux