Forum Discussion

Nikson_M's avatar
Nikson_M
Icon for Cirrus rankCirrus
Oct 07, 2021

API's for assigning an iRule to a VIP/code

Team,

We are looking at some automated solution to assign an iRule to a VIP. The idea is that this would a iRule redirecting traffic to a maintenance page.

During the application downtime this iRule would kick in and give the required message to end users/customers.

 

The iRule will be created beforehand and kick in when needed through some automation.

 

Any suggestions?

 

 

Thanks!!

N.

5 Replies

  • Hi Nikson,

     

    K14702105: Use an iRule to display a maintenance page when the pool is down

    https://support.f5.com/csp/article/K14702105

     

    K20405069: Redirect users to a maintenance page containing text and images

    https://support.f5.com/csp/article/K20405069

     

    K36560003: iRule to display a maintenance page using an image

    https://support.f5.com/csp/article/K36560003

    • Nikson_M's avatar
      Nikson_M
      Icon for Cirrus rankCirrus

      Thanks Enes.

       

      What I am looking for is some API to kick in this iRule. We do not needed some F5 operations folks to make this iRule live.

      Some code on-demand should push this iRule.

       

      However, your link to the iRule which says when both the nodes are down kick in this iRule seems to be an option we can look at.

       

      The API would still help best. :)

       

       

      Regards!!

      N.

  • For the same case we use a little trick: we added a fake pool (POOL-trigger in code below) with one fake node without a monitor, that works just like trigger in an Irule. 

    In normal conditions than the fake node in Unknown state the Irule passes traffic to usual logic and than you disable the fake node by hand or API Irule switch traffic to a maintenace pool or hardcore text.  

    And this approach has nice benefit, you don't need to share admin account rights. Account with Operator role can execute this trigger.

     

    when HTTP_REQUEST {

    if { ([active_members POOL-trigger] < 1) } { 

    pool POOL-maintenance

    }

    else {  

    # usual logic

    }

    }

     

    Sample API requests for disable/enable trigger node:

     

    <PATCH> /mgmt/tm/ltm/pool/~partitionname~POOL-trigger/~partitionname~fakenode:443/ -d '{"session":"user-disabled"}'

    <PATCH> /mgmt/tm/ltm/pool/~partitionname~POOL-trigger/~partitionname~fakenode:443/ -d '{"session":"user-enabled"}'

    • Nikson_M's avatar
      Nikson_M
      Icon for Cirrus rankCirrus

      Hi Maxim,

      Do you know any links to these API's documentation?

       

      Regards,

      Nikhil Kulkarni.