The Artima Developer Community
Sponsored Link

Python Buzz Forum
Quick network status of a machine

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Aaron Brady is lead developer for Crestsource
Quick network status of a machine Posted: Aug 6, 2011 3:44 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Aaron Brady.
Original Post: Quick network status of a machine
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Latest Python Buzz Posts
Latest Python Buzz Posts by Aaron Brady
Latest Posts From insom.me.uk

Advertisement

netstat is one of the most powerful tools for quickly grabbing the high-level network state of a *nix machine. While it has a variety of uses, from tracking down resource consumption to debugging broader networking issues, there is a great one-liner which can quickly capture a snapshot of the (TCP) network state of a machine:

$ netstat -tn | awk 'NR>2 {print $6}' | sort | uniq -c | sort -rn
     1618 ESTABLISHED
        4 LAST_ACK
        2 SYN_RECV
        1 TIME_WAIT
        1 CLOSE_WAIT

The output concisely summarizes the number of TCP connections in each connection state. This shows not only the number of simultaneous connections a machine is handling, but can also reveal potentially resource-intensive connection churn. Beyond that, elevated TIME_WAIT and other states may indicate the need to tune kernel settings to get the most out of a machine that hosts high-throughput services.

NB: You may have to make some slight tweaks to the command, depending on your flavor.

Tumblr Engineering

Reblogged because I use the awk / sort / uniq / sort pattern myself over and over again and the world needs more of this.

Read: Quick network status of a machine

Topic: On temporary patches Previous Topic   Next Topic Topic: Good bye LiveJournal, Hello Blogger

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use