Forum Discussion

Brian_Yeager_12's avatar
Brian_Yeager_12
Icon for Nimbostratus rankNimbostratus
Sep 11, 2008

Config Sync with Cron

I'm running a few LTM's on 9.2.4. I'm trying to setup a cron job to automatically sync the active to the standby device every x amount of time. I found this script in some other forums:

 

 

!/bin/sh

 

for Status in $(bigpipe failover show | grep -c "The failover state is ACTIVE")

 

do

 

if [ $Status -eq 1 ]

 

then

 

/bin/bigpipe configsync all

 

else

 

echo "This unit is currently in Standby mode" >> /var/logsync.log

 

fi

 

done

 

 

Seems to work except I believe it was written for 4.x and the bigpipe failover show command no longer returns "The failover state is ACTIVE" or standby. Instead, it returns "FAILOVER active for xxx days", regardless of if you're on the active or standby device.

 

 

Is there an equivalent command that returns active or standby that I could substitute in this script in order to make it work? Alternatively, is there another way to go about this script that will work?

 

 

I appreciate any help.

 

 

===============================================

 

 

Edit: This is the corrected script if anyone finds they need it.

 

 

!/bin/sh

 

for Status in $(bigpipe failover show | grep -c "FAILOVER active")

 

do

 

if [ $Status -eq 1 ]

 

then

 

/bin/bigpipe configsync all

 

else

 

echo "This unit is currently in Standby mode" >> /var/logsync.log

 

fi

 

done

10 Replies

  • Actually it should say "FAILOVER active" on the active and "FAILOVER standby" on the standby. If it states "FAILOVER active" then there is something definately wrong in your configuration.

     

     

  • Ah, you're absolutey right cmbhatt, I'm embarrassed I missed that. I read it wrong. Appreciate your help.
  • We have several HA pairs and wanted to do the config sync with CRON as well. I actually had time to discuss this with a case engineer about do this in a straight forward fashion without a lot of PERL script or other script.

     

     

    There is a simple single command line option to do this within the BIGPIPE commands. The preference would be to do a PULL from the standby unit instead of a push to put the work on the standby unit with more free resources than from the active unit.

     

     

    bigpipe fo | grep -q "FAILOVER standby" && nice b config sync pull

     

  • Orion's avatar
    Orion
    Icon for Nimbostratus rankNimbostratus
    The use of "PS1" is definitely a better way to go, especially if you have a mixed environment. For example, the output of "b failover" on an 6800 running 9.3.1:

     

     

    b failover

     

    FAILOVER standby for 3 days 22:37:17

     

     

    versus an 8800 running 9.4.3:

     

     

    b failover

     

    FAILOVER

     

     

    Using "PS1" makes your cron job a little more portable.

     

     

    Of course this would be a moot point if "auto sync" was incorporated....I seem to remember a post in the iControl9.x forum back in 2005 about that coming in the "next" release.....

     

     

    /Alex K.

     

     

  • ps1 is cleaner, but you should be able to run 'b failover show' to get the same failover state on 9.3.x and 9.4.x:

     

     

     

    uname -a

     

    Linux strong6400.intpslab.net 2.4.21-9.3.1.37.0smp 2 SMP Mon Oct 15 11:49:02 PDT 2007 i686 athlon i386 GNU/Linux

     

     

    b fo

     

    FAILOVER active for 21 days 05:44:05

     

     

    b fo show

     

    FAILOVER active for 21 days 05:44:10

     

     

     

     

     

    uname -a

     

    Linux fips6400.intpslab.net 2.4.21-9.4.5.1049.0smp 2 SMP Wed May 14 12:50:53 PDT 2008 i686 athlon i386 GNU/Linux

     

     

    b fo

     

    FAILOVER active for 1d 12:58:14

     

     

    b failover

     

    FAILOVER active for 1d 12:58:25

     

     

    b failover show

     

    FAILOVER active for 1d 12:59:38

     

     

     

     

    Aaron
  • Orion's avatar
    Orion
    Icon for Nimbostratus rankNimbostratus
    Perhaps, however:

     

     

     

     

    [root@xxxxxxxx:Active] config cat /VERSION

     

    Product: BIG-IP

     

    Version: 9.4.3

     

    Build: 18.0

     

    BaseBuild: 1.4

     

    Edition: Hotfix HF4

     

    Date: Wed Jul 16 12:06:51 PDT 2008

     

    Built: 080716120651

     

    Changelist: 580545

     

    [root@xxxxxxxx:Active]config uname -a

     

    Linux xxx.xxx.xxx.xxx.xxx 2.4.21-9.4.3.1.0smp 2 SMP Wed Oct 17 19:47:50 PDT 2007 i686 athlon i386 GNU/Linux

     

    config

     

     

    [root@xxxxxxxx:Active] config b failover show

     

    FAILOVER

     

    [root@xxxxxxxx:Active] config b failover

     

    FAILOVER

     

    [root@xxxxxxxx:Active] config b fo

     

    FAILOVER active for 55d 18:28:33

     

    [root@xxxxxxxx:Active] config

     

     

     

     

    So "fo" is short for "failover", but yeilds different results....a bit odd me thinks....

     

     

    /Alex K.
  • Posted By jphugo on 09/16/2008 7:55 AM

     

     

    bigpipe fo | grep -q "FAILOVER standby" && nice b config sync pull

     

     

     

    Right on. This seems to be the best approach. Compatible with v10.0. Thanks!
  • bigpipe fo | grep -q "FAILOVER standby" && nice b config sync pull

     

     

    the above one sounds like a better solution. I m a newbee to F5 and linux. Can anybody help me out in setting up the above task as cron job scheduled daily at 9 o clock. Detail steps would be appreciated. one more confusion that

     

     

    "bigpipe fo | grep -q "FAILOVER standby" && nice b config sync pull" is a command or a script as mentioned in one blog

     

     

    !/bin/sh

     

    /bin/bigpipe fo | grep -q “FAILOVER standby” && nice b config sync pull

     

     

    TIA

     

     

    Ronnie