Pool Member Status Page on a Virtual Server v11

I have gone over the “Pool Member Status Page” pages for both v9 and v10. It all seems easy and straight forward; however, I am on v11, and it doesn’t yet seem like I can do the slick trick of writing to a file on disk and thusly having it slip into the data-group file.

The simple bash script works great:

Remove previous pool member list file
rm -f /var/tmp/pool_member_status_list.class
 Step through Pool Members
for POOLNAME in `tmsh list ltm pool | grep -i "ltm pool" | sort | awk '{print $3}'`; do
        for POOLMEMBER in `tmsh list ltm pool $POOLNAME | grep : | sort | awk '{print $1}'`; do
                echo \"$POOLNAME/$POOLMEMBER\", >> /var/tmp/pool_member_status_list.class        Write data pairs to file
        done
done

But I have to add the following line to get the data to actually update:

tmsh modify /sys file data-group pool_member_status_list source-path file:/var/tmp/pool_member_status_list.class

And of course here is my iRule with the HTTP Response:

when HTTP_REQUEST {
 if { [HTTP::uri] eq "/status" } {
  foreach { selectedpool } [class get pool_member_status_list ] {
   if { [catch {
    scan $selectedpool {%[^/]/%[^:]:%s} poolname addr port
    switch -glob [LB::status pool $poolname member $addr $port] {
     "up" {
     }
     "down" {
     }
     "session_enabled" {
     }
     "session_disabled" {
     }
     Default {
     }
    }
    SWITCH END
   } errmsg] } {
   }
  }
  HTTP::respond 200 content $response "Content-Type" "text/html" "Content-Type" "text/html" "Cache-Control" "no-cache, must-revalidate"
 }
 FIRST CONDITIONAL STATEMENT END
}

So if you’re still with me… This does work. However, I want to be able to change the contents of the data-group class file outfrom under BIG-IP. With the previous v9 and v10 versions, you could just update the file with your bash script, then when BIG-IP looked for /var/class/pool_member_status_list.class it would just take that data in and work with it. Now I think I have been reading around the forums that this will not work anymore as this feature/bug/ability was closed up for security concerns in v11.

Thus, does anyone else know how I can swap out the information in the class file, or perhaps a totally different method of garnishing the data into BIG-IP to begin with, without needing to also have my bash script issue a “tmsh modify /sys file data-group” or reloading the config?

Please and thank you!

The v9/v10 update scripts have a ‘b load’ command at the end to get big-ip to pick up the data group changes, what’s wrong with basically doing the same with tmsh command?

change the bash script to something like this and it should work:

!/bin/bash

tmsh modify sys db bigpipe.displayservicenames value false

classfile="/tmp/classfile"

for POOLNAME in `tmsh list ltm pool | grep -i "ltm pool" |  sort | awk '{print $3}'`; do
    for POOLMEMBER in `tmsh list ltm pool $POOLNAME | grep : | sort | awk '{print $1}'`; do
            echo \"$POOLNAME/$POOLMEMEBER\", >> ${classfile} 
    done
done

tmsh modify /ltm data-group external pool_member_status_list source-path file:${classfile}  separator ":="

rm ${classfile}

exit 0`

This worked on 11.6

There is misstypo:

incorrect: echo \“$POOLNAME/$POOLMEMEBER\”, >> ${classfile}

correct: echo \“$POOLNAME/$POOLMEMBER\”, >> ${classfile}

To David Scott: Please reformat your post on page DevCentral - An F5 Technical Community Not readable, try use style Preformatted Code