+ Reply to Thread
Results 1 to 3 of 3

Thread: configSync automation script

  1. #1

    Exclamation configSync automation script

    hi guys

    I am new to both Lynx and scripting, currently I am responsible for half a dozen F5 Bigip.

    Therefore, since I have no openbsd experience I have had to jump in at the very deep end.

    My problem is that I need to make a script to enable our bipip version 4.64 to ensure that both active and standby configs are in sync.

    My criteria is something like:

    issue command "b failover" this will check that node is active or in standby.

    Now if it is active I need to run the following command:

    b config sync

    I am going to configure a cron job however reading shell scripting so far has been bewildering as I have no unix experience. I have come up with this so far:

    #!/bin/bash
    #< ensuring both F5’s configs are in sync
    a=’echo b failover!’
    b=’The failover state is ACTIVE.’
    echo b failover | sh

    echo $a
    if [ "$a eq "$b""]
    then
    b config sync

    exit

    will this work? if not can you ammend it ?


    In addition, if I can be so cheeky If I would like to send success or failure to syslogger???

    if possible can someone advise what commands i would need to check both nodes configs and then run a config sync from active to standby or am I asking for too much

  2. #2
      Advisor redhead redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    756
    Code:
    #!/bin/bash
    #< ensuring both F5's configs are in sync
    a='echo b failover!'
    b='The failover state is ACTIVE.'
    echo b failover | sh
    echo $a
    if [ "$a eq "$b""]
    then
    b config sync
    exit
    This most likely wont work..
    Since I have no experience with Big-ip, I’m not very good at communicating with any of the nodes, but something like this migth get you further:
    Code:
    #!/bin/sh
    # 
    # script to check if backup node is active and in sync with master node
    # get ACTIVE or anything else from the node
    ACTIVE=`bigip failover`
    if [ "$ACTIVE"x != x ]; then
      # there is a value stored in $ACTIVE
      case "$ACTIVE" in
          "The failover state is ACTIVE.")
              logger -t Big-ip -p local3.info "Syncing the two nodes config"
              bigip config sync
          ;;
          * )
              # Anything which dosn't match our criteria
              logger -t Big-ip -p local0.notice "Unexpected return from failover check: $ACTIVE"
          ;;
      esac
    else
      # $ACTIVE contains nothing, perhaps an error ?? 
      logger -t Big-ip -p local0.notice "Unexpected NULL from failover check"
    fi
    In addition, if I can be so cheeky If I would like to send success or failure to syslogger???
    Look at the logger(1) program:
    NAME
    logger – a shell command interface to the syslog(3) system log module

    SYNOPSIS
    logger [-isd] [-f file] [-p pri] [-t tag] [-u socket] [message …]
    Last edited by redhead; 02-12-2007 at 11:15 PM.
    Don’t worry Ma’am. We’re university students, – We know what We’re doing.
    ‘Ruiat coelum, fiat voluntas tua.’
    Datalogi – en livsstil; Intet liv, ingen stil.

  3. #3
    Originally Posted by redhead
    This most likely wont work..
    Since I have no experience with Big-ip, I’m not very good at communicating with any of the nodes, but something like this migth get you further:
    Code:
    #!/bin/sh
    # 
    # script to check if backup node is active and in sync with master node
    # get ACTIVE or anything else from the node
    ACTIVE=`bigip failover`
    if [ "$ACTIVE"x != x ]; then
      # there is a value stored in $ACTIVE
      case "$ACTIVE" in
          "The failover state is ACTIVE.")
              logger -t Big-ip -p local3.info "Syncing the two nodes config"
              bigip config sync
          ;;
          * )
              # Anything which dosn't match our criteria
              logger -t Big-ip -p local0.notice "Unexpected return from failover check: $ACTIVE"
          ;;
      esac
    else
      # $ACTIVE contains nothing, perhaps an error ?? 
      logger -t Big-ip -p local0.notice "Unexpected NULL from failover check"
    fi
    Look at the logger(1) program:
    Hi Red thanks a lot for that… looks like a goer I will give it a try….

    recieved another option from load balancer forum:

    syncscript1:

    #!/bin/sh
    for Status in $(bigpipe failover show | grep -c "The failover state is
    ACTIVE")
    do
    if [ $Status -eq 1 ]
    then
    bigpipe configsync all
    else
    echo "This unit is currently in Standby mode"
    >> /var/logsync.log

    fi

    done

    based on your script I will combine your logger bit..

    once again very much appreciated

+ Reply to Thread

Similar Threads

  1. SSH and bash script
    By vwgtiturbo in forum Programming
    Replies: 7
    Last Post: 12-25-2008, 05:40 AM
  2. Firewall script in RHEL 4
    By sud.tech in forum Programming
    Replies: 8
    Last Post: 06-12-2008, 02:07 PM
  3. Rsync incremental backup script
    By vwgtiturbo in forum Programming
    Replies: 6
    Last Post: 06-07-2006, 09:19 PM
  4. Shell Script to modify apachectl
    By gaxprels in forum Programming
    Replies: 6
    Last Post: 07-23-2002, 08:18 PM
  5. running script automatically on boot up
    By morphman in forum Programming
    Replies: 1
    Last Post: 04-29-2002, 08:53 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts