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

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
}

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!