Forum Discussion

LyonsG_85618's avatar
LyonsG_85618
Icon for Cirrostratus rankCirrostratus
Aug 25, 2011

running BIGPIPE commands in an IRULE

Hi.

 

 

Does anyone know if it's possible to run BIGPIPE commands in an IRULE?

 

 

I would like to run 'b failover show' and then extract the response.

 

 

If the unit is in ACTIVE mode then the IRULE will continue (its doing HSL logging to a remote syslog server).

 

 

If the unit is in STANDBY mode the irule will end (no remote logging).

 

 

Many thanks.
  • Hi Graham,

     

     

    iRules should only ever execute on an active unit, so I am not sure this is necessary. Are you seeing otherwise?

     

     

    There isn't a way to run bigpipe commands from an iRule. I remember Unruley mentioning a bit of a hack you could use to determine the unit number from an iRule. I think this involved a shell script writing to a datagroup. If you wanted to get arbitrary, real time-ish data from a shell script, you could try this method.

     

     

    Aaron
  • Thanks for quick reply!

     

     

    We ARE seeing IRULES being executed on the standby unit. We do have connection mirroing setup though so this may be why this is happening?

     

     

     

  • "I remember Unruley mentioning a bit of a hack you could use to determine the unit number from an iRule. "

     

     

    Do you know what this hack is? I am keen to find out as we are seeing duplicate log entries on a syslog server due to the irule being executed on the activ & standby BIG-IP's.
  • Hi Graham,

    The idea is that you'd run a bash or Perl script from cron on LTM which gets the failover status, writes the output to a file which is referenced in an external datagroup and then use iControl to force a reread of the datagroup contents. You could then access the datagroup from an iRule and check to see it returns active before calling HSL commands.

    The external datagroup format is:

    External Class Format:

    
    class namevalue {
      "name1" := "value",
    }
    

    As you don't need a value, you could use:

    class active_status_class {

    "active",

    }

    For 10.2.x you can use 'bigpipe failover' or 'tmsh run /util bigpipe failover' to get the failover status. For 11.0.x you can use 'tmsh show /sys failover'

    Here's a Perl iControl example from Joe for updating the datagroup:

    http://devcentral.f5.com/wiki/iControl.PingExternalClass.ashx

    Aaron
  • It would make sense for us to have a default TCL variable that gives the HA status of the unit in an iRule. You could open an RFE case with Support to request this. If you do, could you reply back with the RFE ID so others can pile on?

     

     

    Thanks, Aaron