Forum Discussion

LEON_LI_38034's avatar
LEON_LI_38034
Icon for Nimbostratus rankNimbostratus
Sep 11, 2014

The percentage of the total number of "active member", execute the TMSC modify command.

Hi All. My customer have a request.

 

When total number of active's pool member less than 70% in WebPool,and then automatic disable LTM 1.1 interface.

 

When total number of active's pool member more than 70% in WebPool,and then automatic enable LTM 1.1 interface. What good method?

 

Thanks.LEE

 

5 Replies

  • Do you mean physical NIC's on the F5?

     

    I'm not sure you can easily do it, or if it would be supportable or why you would want to.

     

  • this is actually a great use case for an iCall script. You can use a periodic icall handler to kick off a script every x number of minutes, and if percentage of available members drops below your threshold, the script can initiate a a shutdown of the interface.

     

  • You'll need to customize to only actually modify when there is a change in state rather than because the status is above/below the threshold (as I've shown below with the simple if/else condition), but this should get you started down the path:

      foreach pn $pool_names {
         set total 0
         set usable 0
         foreach obj [tmsh::get_status /ltm pool $pn detail] {
             foreach member [tmsh::get''field''value $obj members] {
                incr total
                if { [tmsh::get''field''value $member pool-member.status.availability-state] == "available" &&
                     [tmsh::get''field''value $member pool-member.status.enabled-state] == "enabled" } {
                         incr usable
                   }
             }
         }
         if { [expr $usable.0 / $total] < 0.7 } {
        tmsh::modify /net interface 1.1 disabled
         } else { tmsh::modify /net interface 1.1 enabled }
      }