Forum Discussion

trx's avatar
Oct 13, 2011

monitoring external file via IRules

Hello community,

I was trying to figure out if it's possible can monitor an external file using IRules.

 

So example would be:

 

 

 

when HTTP_RESPONSE {

 

 

 

if { (http://cont145.qad.com/zbc.tx) } {

 

Read values

 

if { ("ACTIVE" in the file) } {

 

Route traffic to member A of pool

 

} else {

 

Route traffic to member B of pool

 

}

 

 

 

}

 

}

 

 

 

Thanks in advance.

 

 

 

Regards,

 

TRX

 

 

 

  • Hi trx,

     

     

    Someone else asked a similar question some time ago here: http://devcentral.f5.com/Community/GroupDetails/tabid/1082223/asg/50/aft/1178691/showtab/groupforums/Default.aspx

     

     

    I would suggest that rather than doing this with an iRule, why don't you use Health Monitors and Priority Activation Groups?

     

    Put all servers in a single pool (assign Priority Groups if desired) and add a custom health check that will look for the "Active" return of a get to "/zbc.tx".

     

     

    If they do not pass the health check they will be marked down and traffic routed to the other servers. Rather than an all or nothing with a pool of servers you would be able to do them individually and still maintain a preference between A and B Servers.

     

     

    Just a thought.

     

     

    Hope this helps.
  • Best solution I found:

     

     

     

     

    HTTP_REQUEST {

     

    ................

     

    2 Virtual servers HTTP/HTTPS

     

    2 Pools "YYY and ZZZ"

     

    YYY/ZZZ pool member IP 192.168.254.289 over port 80 contains

     

    health monitor that looks at a text file string. If the string

     

    is NOT there the member YYY/ZZZ is marked DOWN.

     

     

     

    If YYY/ZZZ is marked DOWN, route traffic to ONE of the pool members YYY/ZZZ

     

    if { ([pool YYY/ZZZ member 192.168.254.189 80] < 1) } {

     

    go to fail over server

     

    pool YYY/ZZZ member 167.3.11.93 443

     

    } else {

     

    stay on primary server

     

    pool YYY/ZZZ member 167.3.10.93 443

     

    }

     

     

    ........

     

    }

     

     

     

    Hope this helps anyone else.

     

     

     

    Thanks!

     

     

     

    Regards,

     

    TRX