LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Mon Script

To: <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Mon Script
From: "Michael McConnell" <michaelm@xxxxxxxxxxx>
Date: Fri, 31 Aug 2001 14:27:00 -0700
Here is the alert I use in mon.
The one that comes with configure seems out of date.
 
Michael McConnell
 
 
########## mon.cf ########
# Declare each host in MON.CF
# duplicate the hosts in /etc/hosts file to match the num of machines
# ie 10.1.1.1 www.dog.com
# 10.1.1.1 www1.dog.com
# 10.1.1.1 www2.dog.com
# Increment the Watch Variable depending on the system
 
watch www1.dog.com
        service 80
        interval 30s
        monitor http.monitor
        period wd {Sun-Sat}
         alert lb-host.alert
         upalert lb-host.alert
         alertafter 5
         numalerts 20
 
########## lb-host.alert #######
#!/usr/bin/perl
# opt_g = hostgroup
# opt_s = service
# opt_h = host
 
use Getopt::Std;
getopts ("s:g:h:t:l:V:R:u");
 
open (FILE,">>/var/log/monaction.log");
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime(time);
if ($opt_u) {
system("/sbin/ipvsadm -a -t $opt_g:$opt_s -R $opt_h -m -w 10");
print FILE "Virtual server $opt_g up \n";
print FILE "$Date: $mday-$mon Time: $hour:$min:$sec \n";
}
else {
system("/sbin/ipvsadm -d -t $opt_g:$opt_s -R $opt_h");
print FILE "-=-=- LB-HOST -=-=- \n";
print FILE "Service: opt_s $opt_s \n";
print FILE "Group: opt_g $opt_g \n";
print FILE "Hosts: opt_h $opt_h \n";
print FILE "Time: opt_t $opt_t \n";
print FILE "Date: $mday Month; $mon Time; $hour:$min:$sec \n";
};
close FILE;
<Prev in Thread] Current Thread [Next in Thread>