Forum Discussion

uni's avatar
uni
Icon for Altostratus rankAltostratus
May 25, 2011

iRule to act on external events

I have a customer who wishes to redirect requests to their site depending on the existence of a flag file within their site. I can create a cron job or external monitor to test for the existence of this file, but want suggestions as to how to refer to this within my iRule.

 

 

Is there some way to check for a local file, or environment variable, within a rule applied to a virtual?

 

 

There may be another way of achieving the above requirement. I am open to suggestions.

 

 

  • You could put a health monitor on a dummy node that hits the file and then use LB::status to see if it is up.
  • You could configure a Custom Health Monitor.

     

     

    Send String:

     

    GET /file.directory.inside.website/file.name.html\r\n

     

     

    Receive String:

     

    "Content Value String"

     

     

    This will monitor for the holistic response from the monitored file (like if it only had the word "Active" in it, it would look for that in the receive string to determine if the node was available).
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus
    Posted By David Windeyer on 05/25/2011 02:38 AM

     

    You could put a health monitor on a dummy node that hits the file and then use LB::status to see if it is up.

     

    I like this, but how would I stop the dummy node from receiving client requests?

     

  • I think Michael was suggesting that you create a pool and monitor without referencing the pool on a virtual server. This would allow you to monitor the pool member but not send any traffic to it. You could then check the state of the pool member using LB::status or of the pool using active_members:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/lb__status

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/active_members

     

     

    Aaron
  • uni's avatar
    uni
    Icon for Altostratus rankAltostratus
    Brilliant. Thanks Michael and Hoolio.

     

     

    I didn't realise that a monitor is active in a pool even if the pool is not assigned to a virtual, but in hindsight this makes sense.