Forum Discussion

dave_20485's avatar
dave_20485
Icon for Nimbostratus rankNimbostratus
Aug 05, 2010

Triggering a holding page for all virtual servers

Hi there,

 

 

I've been searching around the forums looking for an answer to this Q, and haven't found it, but if there is already a posted solution then please point me in the direction of it...

 

 

I have a pair of 1600's running 10.1.0 and use it to terminate SSL connections, so I have quite a few virtual servers ( > 100 ) configured using the same backend pools.

 

 

What I want to do is be able to put up a holding page using some kind of trigger for all virtual servers, without having to add an irule manually to each server every time we hit a maintenance slot.

 

 

I can manually add an irule to serve the holding page for each server, but its laborious adding it to more than a few servers.

 

 

What I had in my head was an irule present on all virtual servers which went something like this

 

 

if some_condition

 

then

 

display holding page

 

else

 

do nothing and carry on

 

 

where some_condition is a check for the result of a single manual task such as creating a file on the filesystem called "IN_MAINTENANCE" ( or similar )

 

 

I've looked at data groups but confess to not understanding them very well, and whether that is the right place to be looking in the first place.

 

 

Any help is always appreciated !

 

 

cheers,

 

Dave

 

 

2 Replies

  • Hi Dave,

    In order to have an iRule take effect on all virtual servers, the iRule would need to be applied to all virtual servers. I think your initial thought on a single iRule which is applied to all VS's that checks for a value in a datagroup would be a good way to implement this. Here is a simple, untested example:

    
    when HTTP_REQUEST {
    
        Check if the global_maintenance_class's single name is 1 or 0
       if {[class element -name 0 global_maintenance_class] == 1}{
    
           Send the maintenance HTML with cache control headers set to prevent caching
          HTTP::respond 200 content {maintenance info here} Cache-Control No-Cache Pragma No-Cache
       }
    }
    

    It would be most efficient to only add this iRule when you want to send the maintenance response. Else, you'd need to do a datagroup lookup on every HTTP request to every VS. You could create a simple iControl app which adds the iRule to all VS's that is run either from a remote host or the LTM unit itself.

    You could expand on this to example to serve HTML and images which the HTML reference. See the maintenance page examples in the Codeshare for details:

    http://devcentral.f5.com/wiki/default.aspx/iRules/CodeShare.htmlUtility

    (search for maintenance)

    Aaron
  • Cheers Aaron, thanks for pointing me in the right direction. Will have a play around with icontrol ( thats completely new to me ) to get where I want to be.

     

     

    Thanks also for the links, will go away and digest how those examples work...