Forum Discussion

JoeBlogs1759_10's avatar
JoeBlogs1759_10
Icon for Nimbostratus rankNimbostratus
Jul 19, 2012

Display number of current connections for a pool

Hello, I currently have an iRule to display the status of the members of a pool used by a third-party who I can give access to the box. This works fine but I wrote so long ago I can't remember most of it.

 

 

 

What I need now is to display the number of connections for each pool member either within the same iRule or individual iRules for each member.

 

 

 

 

 

To use this iRule I simply create a VIP and attach this without any pools.

 

browse to http://[ip]/F5-status

 

 

 

when HTTP_REQUEST {

 

set response "

 

 

BIGIP Pool Status for FP Prod/Stby - [clock format [clock seconds]]</div> <div> <span class="Apple-tab-span" style="white-space:pre"> </span>

 

"

 

if {[HTTP::uri] eq "/F5-status" } {

 

foreach { selectedpool } [LB::server pool] {

 

pool [LB::server pool]

 

if { [active_members [LB::server pool] ] < 1 } {

 

 

 

append response "$response DOWN - $selectedpool

 

"

 

} else {

 

 

append response "$response UP - $selectedpool

 

"

 

}

 

append response "Number of members=[active_members [LB::server pool] ]

 

"

 

 

 

}

 

HTTP::header replace Cache-Control "no-cache, must-revalidate"

 

HTTP::respond 200 content $response "Content-Type" "text/html"

 

}

 

}

 

 

  • in 10.x, i understand we have to count it manually something like what kevin does in the discussion topic below.

     

     

    i guess the feature in 11.x which Jason mentioned is istats. anyway, i do not see much information so far. hope Jason or someone else can suggest here. :-)

     

     

    Connection Statistics

     

    https://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1182583/showtab/groupforums/Default.aspx
  • In 9.4.x the only option I can think of for this is to write a shell script that calls bigpipe and writes the current connection counts to a data group every X seconds. You could then read the data group from the iRule.

     

     

    In 10.1+ you could track the connection count in a subtable using the table command. In a future version, it should be possible to access the connection stats from an iRule more directly.

     

     

    Aaron
  • Thanks Aaron and others.

     

     

     

    Aaron I assume you are saying:

     

    Create a cron job to call a script which runs a bigpipe command to query the members of X pool and writes the output to a file.

     

    I can then use a VIP and iRule to display this file to the users.

     

     

     

    I don't want a hand-out, unless you are willing toooo. But do you have a sample script and relevant iRule I can hack to achieve this and what's the bigpipe command I need to call?

     

     

     

    Thanks...