Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
configSync automation script
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
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811
    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
    Quote Originally Posted by redhead View Post
    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

Similar Threads

  1. script
    By try in forum Linux - General Topics
    Replies: 0
    Last Post: 12-15-2008, 07:43 AM
  2. SSH in a script question...
    By vwgtiturbo in forum Programming
    Replies: 6
    Last Post: 06-14-2006, 11:49 PM
  3. Bash script
    By linuxuser in forum Programming
    Replies: 1
    Last Post: 09-01-2005, 03:21 PM
  4. Probs in a script called from another script
    By Outlaw in forum Programming
    Replies: 1
    Last Post: 03-12-2004, 02:54 PM
  5. Email automation
    By Schotty in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 05-13-2002, 11:01 AM

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
  •