Forum Discussion

Justin_Adrian_3's avatar
Justin_Adrian_3
Icon for Nimbostratus rankNimbostratus
Mar 09, 2010

iRule to check for iRules

Bit of a strange request but I am at a loss.

I am looking for any syntax that I can use that would allow me to check for the number of irules assigned to a VIP.

For instance.

 
 virtual test.f5.com { 
    pool test.f5.com 
    destination 1.2.3.4:any 
    ip protocol tcp 
    rules master_irule secondary_irule 
    profiles { 
       test.f5.com { 
          clientside 
       } 
       http {} 
       serverssl { 
          serverside 
       } 
       tcp {} 
    } 
 } 
 

The master_irule does pool validation, defines what ports it needs to talk to and manages the sorry server function. However, in my example above, the secondary_irule will then be the next to be executed before reading my pool.

I have a need to check for the quantity of irules, and if that quantity of irules is > 1, then write a clause in my first irule to ignore any pool validations.

These are dynamically updated irules that we use as a generic deployment. And sometimes the admins mistakenly combine a vanity irule with a pool. When the pool is down, or not existant the site is down, as the check in the master_irule is checking first for the status of the pool, up or down. If it is down, it sends the user to the sorry server. It will never process the 2nd irule.

Thanks,

--J

1 Reply

  • I don't think you can get a count of iRules enabled on the VIP from an iRule. But maybe you could set a variable in the first rule that the second one references to know it doesn't need to run a specific block of code?

     

     

    You can check whether a variable has been set using [info exists rule1_var].

     

     

    Aaron