Forum Discussion

Mikoto_Misaka_1's avatar
Mikoto_Misaka_1
Icon for Nimbostratus rankNimbostratus
Mar 15, 2006

VIP's Current Connection

Hello,

 

 

I would like to log the number of VIP's current Connection.

 

So, Is there the variable of VIP's current Connection on iRule ?

 

 

For example,

 

when a VIP's current connection reaches at 100, BIG-IP logs it,then sends snmp trap or syslog.

 

However it's alert only. Not connection limmit for VIP, BIG-IP have to accept 100 over request.

 

 

when HTTP_REQUEST {

 

if { [Current::Conn] > 100 }{

 

log "The current connection reached at 100."

 

}

 

}

 

 

Is threre a varialble as "[Current::Conn]" ?

 

 

Reagards,

 

Mark

5 Replies

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    There are currently no statistics available to perform this function directly within a rule.

     

     

    There are a number of rules posted on the forum which count concurrent connections/sessions for purposes of imposing limits. Perhaps the method of tracking current connections demonstrated there could be leveraged to meet your goal of simply counting and logging?

     

     

    HTH

     

    /d
  • Try this:

    
    when CLIENT_CONNECTED {
      set curr_conns 0
      incr curr_conns
      if ( $curr_conns >= 100) {
        log "Total Connections = $curr_conns"
      }
    }
    when CLIENT_CLOSED {
      incr curr_conns -1
    }
  • actually, try this:

    
    when RULE_INIT {
      set curr_conns 0
    }
    when CLIENT_CONNECTED {
      incr curr_conns
      if ( $curr_conns >= 100) {
        log "Total Connections = $curr_conns"
      }
    }
    when CLIENT_CLOSED {
      incr curr_conns -1
    }
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    You probably want that variable to be global... Add :: to the front of it...
  • Doing this will cause a log entry for every new connection while total connections is 100 or more. This is probably not desirable. You might want to include some additional logic to only log total connections once a minute while connections are 100 or more:

    
    when RULE_INIT {
      set ::curr_conns 0
    }
    when CLIENT_ACCEPTED {
      incr curr_conns
      if { $::curr_conns > 99 } {
        if { [clock format [clock seconds] -format {%S}] equals "00" } {
          log "Total Connections = $::curr_conns"
        }
      }
    }
    when CLIENT_CLOSED {
      incr ::curr_conns -1
    }

    Standard disclaimer, not tested!