Forum Discussion

Eric_Frankenfie's avatar
Eric_Frankenfie
Icon for Nimbostratus rankNimbostratus
Nov 01, 2018

Track number of connections for each pool member

I am looking for a way to track the number of connections each pool member has currently and if that number exceeds a value write to the log file.

 

This is in preparation to setting max connections for each pool member, but we first want to log what would occur for a week or so before we implement the hard limits.

 

vs_a >> pool_a

 

pool_a has four members: server_[1-10]

 

When server_[1-10] is selected, increment the associated variable (server_[1-10]) by 1 and when that connection is closed decrease by 1.

 

If any of the variables is greater than 100 write an entry to the log file.

 

I already have the following code to track the virtual server connections, but I am having trouble tracking the pool member connections.

 

Thanks in advance!

 

when RULE_INIT {
 Set a global max for number of concurrent TCP connections 
  set ::capture_sco2_max_connections 8800
 Initialize a counter for active connections (don't modify this) 
  set ::capture_sco2_active_connections 0
} 

    when HTTP_REQUEST {
     If we're over the limit for this connection, write to log file 
      if {$::capture_sco2_active_connections > $::capture_sco2_max_connections} {
        log local0. "capture_sco2 has exceeded its connection limit and the status page would have been presented"
      }
      else {
       If we're over the limit for this connection, write to log file
          incr $::capture_sco2_active_connections 1
      }
    }

    when CLIENT_CLOSED {
     Decrease capture_sco2_active_connections by 1
      incr $::capture_sco2_active_connections -1
    }
No RepliesBe the first to reply