Check nginx active connection without HttpStubStatusModule

27,995

Try excluding TIME_WAIT or grepping ESTABLISHED only

netstat -an | grep :443 | grep -v TIME_WAIT | wc -l

or

netstat -an | grep :443 | grep ESTABLISHED | wc -l
Share:
27,995

Related videos on Youtube

Howard
Author by

Howard

Updated on September 18, 2022

Comments

  • Howard
    Howard almost 2 years

    We want to check the number of active connections without the module HttpStubStatusModule being installed.

    What would be the equivalent Linux command?

    As a base line, we test on a machine with HttpStubStatusModule installed first, e.g.

    Active connections: 6146 <-- from HttpStubStatusModule
    
    # netstat -an | grep :80 | wc -l
    1266
    
    # netstat -an | grep :443 | wc -l
    25082
    

    It seems to me that none of the above netstat give me the correct figure.

    Any idea?

    • kei1aeh5quahQu4U
      kei1aeh5quahQu4U almost 11 years
      Did you consider checking only for established connections? e.g. $ sudo netstat -antp | grep ESTABLISHED | grep nginx
  • Martin Dimitrov
    Martin Dimitrov almost 5 years
    The two commands give very different results. The first reports 3380 connections but the second - just 9. Why is that so? We use WebSockets. Can this be the reason?
  • whirlwin
    whirlwin about 2 years
    This is very brittle. What if there is other software running on the machine, e.g. other monitoring systems ingress/egress which connects to 443?