LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: LVS Control Scripts? (was LVS-NAT two nic / two network problem)

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: LVS Control Scripts? (was LVS-NAT two nic / two network problem)
From: "Kip Iles" <kip@xxxxxxxxxxxxxxx>
Date: Wed, 27 Mar 2002 14:24:34 -0500
Simple 5 minute script using mon .....

typeset -a STAT
SLEEP=10
VS1=x.x.x.x  # to protect the guilty - put your own VIP here
RS1=172.16.2.15
RS2=172.16.2.16
HTTP=80
BIND=53
STAT[1]=1
STAT[2]=1
HPING="/usr/local/mon/mon.d/http.monitor -p 80 -t 2 -o"

trap "echo $0 killed; ipvsadm -ln; exit 1" SIGINT

echo "NBNMON Startup at `date`"

vs() {
        if [ "${STAT[$2]}" = "1" ] #UP
        then
                if [ "$1" = "-a" ] #ADD
                then
                        return
                else
                        echo "Deleting $3"
                        STAT[$2]=0
                fi

        else #DOWN

                if [ "$1" = "-d" ] #DEL
                then
                        return
                else
                        echo "Adding $3"
                        STAT[$2]=1
                fi
        fi

        ipvsadm $1 -t ${VS1}:$HTTP -r $3 $4
}

#MAIN =============================================

while :
do
        if ( $HPING $RS1 >/dev/null )
        then
                vs -a 1 $RS1 -i
        else
                vs -d 1 $RS1
        fi

        if ( $HPING $RS2 >/dev/null )
        then
                vs -a 2 $RS2 -i
        else
                vs -d 2 $RS2
        fi

        sleep $SLEEP
done
ipvsadm -ln
echo "NBNMON Shutdown at `date`"
exit 0

----- Original Message -----
From: "Jon Molin" <Jon.Molin@xxxxxxxxxxx>
To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Wednesday, March 27, 2002 3:35 AM
Subject: Re: LVS Control Scripts? (was LVS-NAT two nic / two network
problem)


> Have you tried mon?
>
http://www.linuxvirtualserver.org/Joseph.Mack/HOWTO/LVS-HOWTO-21.html#ss21.5
>
> /Jon
>
> jlobascher@xxxxxxxxxxxxx wrote:
>
> Am in the process of writing some 'control' scripts for my lvs and
> thought to ask the list if anyone has already done this?
>
> What I am writing is simple 'up/down' scripts to remove realservers from
> the LVS pool - ie: pass the realserver name as a parameter to one script
> and it will remove the server from the list (for maintainence etc) and
> then another script to add servers.
>
> Anyone got something like this?  If not I will post mine once they are
> complete.
>
> jeremy
>
> _______________________________________________
> LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
> Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
> or go to http://www.in-addr.de/mailman/listinfo/lvs-users
>



<Prev in Thread] Current Thread [Next in Thread>