Sunday 15 February 2015

linux - Getting count of open connections -


I have automated the deployment of my application through the fabric and I have a new step that I need to add That's where I take my application and then rotate the load balancer, then see the inbound connections from the Balancer till they go to 0. The problem is, I do not know how to calculate the inbound connection

I can use TCPDump to view my port post though, it is very difficult to use in the fabric What do I want To run a loop with only one timer which keeps the number of active inbound connections and turns out at 0. Has anyone done something like this? Or maybe someone would know how I can get it by opening it and I can put it in the cloth?

itemprop = "text">

netstat is one of the simplest ways to get this information, though You noted, yielding the sub-optimal result of netstat by using grep , because it is incoming and outgoing connections (without at least one complex search expression, or Cut or prioritized with preference). Instead, I would recommend this route:

  netstat -ap | Awk '$ 1 == "TCP" & amp; Amp; $ 4 ~ /: (80 | 443) $ / '| Wc -l  

These connections will be counted, which are TCP-based, and connected to the local end or port 80 or 443, which will conform to the incoming connection. Change to $ 4 with $ 5 instead to get an outgoing connection.


No comments:

Post a Comment