Forum Discussion

Jim_Moore's avatar
Jim_Moore
Icon for Nimbostratus rankNimbostratus
Apr 01, 2015

Pool member status iRule version 11 node name

Running into another issue. In version 11 there is a name field for nodes. If the name field is populated it is displayed as the pool member. The bash script will put name:port in the class file.

 

example:

 

"poolname/nodename:port" (This returns invalid i'm guessing due to LB::status looking for addr not name) "poolname/IP:port" (This works)

 

The iRule will then run LB::status pool $poolname member $addr $port.

 

For any pool member that is listed by name it will return INVALID. If I manually change the class file to the IP it returns the correct state?

 

Has anyone found a workaround for this other than putting the IP in the name field?

 

1 Reply

  • Hi,

    I needed to see the previous case to understand what you wanted.

    If I got it, you want to store member's IP instead of member's name, right?

    see if it works to you:
    !/bin/bash
    tmsh modify sys db bigpipe.displayservicenames value false
    rm -f /var/class/pool_member_status_list.class
    
    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 : -A 1 | sed -e 's/address//' | awk -F" " 'BEGIN {i=0} { if ($1=="--") { i=0; next; } else if (i==0) { a=$1; } else if (i==1) { print $1":"a; } else { i=0; next;}; i++; }' | awk -F":" '{print $1":"$3}'`; do
          echo \"$POOLNAME/$POOLMEMBER\", >> /var/class/pool_member_status_list.class
        done
    done
    
    if [ "`cat /var/prompt/ps1`" == "Active" ]; then
        tmsh load sys config
    fi
    
    exit 0
    

    Best regards!