Send Linux-ha-cvs mailing list submissions to linux-ha-cvs@lists.linux-ha.org
To subscribe or unsubscribe via the World Wide Web, visit http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs or, via email, send a message with subject or body 'help' to [EMAIL PROTECTED] You can reach the person managing the list at [EMAIL PROTECTED] When replying, please edit your Subject line so it is more specific than "Re: Contents of Linux-ha-cvs digest..." Today's Topics: 1. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) 2. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) 3. Linux-HA CVS: ldirectord by horms from (linux-ha-cvs@lists.linux-ha.org) ---------------------------------------------------------------------- Message: 1 Date: Tue, 15 Aug 2006 01:13:54 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Rename ld_emailalert_send's emailsubject parameter to subject Signed-Off-By: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- ldirectord.in 15 Aug 2006 07:12:10 -0000 1.25 +++ ldirectord.in 15 Aug 2006 07:13:53 -0000 1.26 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.25 2006/08/15 07:12:10 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.26 2006/08/15 07:13:53 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -3171,7 +3171,7 @@ sub ld_emailalert_send { - my ($emailsubject, $v, $server_str, $currenttime) = (@_); + my ($subject, $v, $server_str, $currenttime) = (@_); my $emailmsg; my $emailfh; my $status = 0; @@ -3196,11 +3196,11 @@ use Mail::Send; - &ld_log("emailalert: $emailsubject"); + &ld_log("emailalert: $subject"); - unless ($emailmsg = new Mail::Send Subject=>$emailsubject, To=>$to_addr + unless ($emailmsg = new Mail::Send Subject=>$subject, To=>$to_addr and $emailfh = $emailmsg->open - and print $emailfh $emailsubject + and print $emailfh $subject and $emailfh->close) { &ld_log("failed to send email message\n"); $status = 1; ------------------------------ Message: 2 Date: Tue, 15 Aug 2006 01:14:41 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Pass rserver instead of server_str to ld_emailalert_send() server_str is a string representation of "$virtual $real" rserver is a string representation of "$real" Passing the latter makes ld_emailalert_send() more consistent with other functions, and also means the caller has to do less work, as $rserver is generally already available. Signed-Off-By: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.26 retrieving revision 1.27 diff -u -3 -r1.26 -r1.27 --- ldirectord.in 15 Aug 2006 07:13:53 -0000 1.26 +++ ldirectord.in 15 Aug 2006 07:14:40 -0000 1.27 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.26 2006/08/15 07:13:53 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.27 2006/08/15 07:14:40 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -2753,13 +2753,13 @@ } &ld_log("Quiescent $log_args (Weight set to 0)"); &ld_emailalert_send("Quiescent $log_args (Weight set to 0)", - $v, $server_str, $currenttime); + $v, $rservice, $currenttime); } else { &system_wrapper("$IPVSADM -d $ipvsadm_args"); &ld_log("Deleted $log_args"); &ld_emailalert_send("Deleted $log_args", $v, - $server_str, $currenttime); + $rservice, $currenttime); } } @@ -2806,7 +2806,6 @@ if(defined($ov)){ $or=$ov->{"real"}->{$rservice}; } - my $server_str=$rservice . " " . $v->{server} . ":" . $v->{port}; if(defined($or)){ unless($or->{"weight"} eq $rwght and get_forward_flag($or->{"forward"}) eq $rforw){ @@ -2814,14 +2813,14 @@ &ld_log("Restored $log_args (Weight set to $rwght)"); &ld_emailalert_send("Restored $log_args " . "(Weight set to $rwght)", - $v, $server_str, 0); + $v, $rservice, 0); } } else { &system_wrapper("$IPVSADM -a $ipvsadm_args"); &ld_log("Added $log_args (Weight set to $rwght)"); &ld_emailalert_send("Added $log_args (Weight set to $rwght)", - $v, $server_str, 0); + $v, $rservice, 0); } } @@ -3171,19 +3170,24 @@ sub ld_emailalert_send { - my ($subject, $v, $server_str, $currenttime) = (@_); + my ($subject, $v, $rserver, $currenttime) = (@_); my $emailmsg; my $emailfh; my $status = 0; my $to_addr; my $frequency; + my $virtual_str; + my $id; + + $virtual_str = &get_virtual($v); + $id = "$rserver ($virtual_str)"; if ($currenttime == 0 or $frequency == 0) { - delete $EMAILSTATUS{"$server_str"}; + delete $EMAILSTATUS{"$id"}; } else { - $EMAILSTATUS{$server_str}->{v} = $v; - $EMAILSTATUS{$server_str}->{alerttime} = $currenttime; + $EMAILSTATUS{$id}->{v} = $v; + $EMAILSTATUS{$id}->{alerttime} = $currenttime; } $to_addr = defined $v->{emailalert} ? $v->{emailalert} : $EMAILALERT; @@ -3220,19 +3224,22 @@ { my $currenttime = time(); my $es; - my $server_str; + my $id; + my $rserver; my $frequency; - foreach $server_str (keys %EMAILSTATUS) { - $es = $EMAILSTATUS{$server_str}; + foreach $id (keys %EMAILSTATUS) { + $es = $EMAILSTATUS{$id}; $frequency = defined $es->{v}->{emailalertfreq} ? $es->{v}->{emailalertfreq} : $EMAILALERTFREQ; + $id =~ m/(.*) /; + $rserver = $1; if ($currenttime - $es->{alerttime} < $frequency) { next; } - &ld_emailalert_send("Inaccessible real server: " . $server_str, - $es->{v}, $server_str, $currenttime); + &ld_emailalert_send("Inaccessible real server: $id", + $es->{v}, $rserver, $currenttime); } } ------------------------------ Message: 3 Date: Tue, 15 Aug 2006 01:16:11 -0600 (MDT) From: linux-ha-cvs@lists.linux-ha.org Subject: [Linux-ha-cvs] Linux-HA CVS: ldirectord by horms from To: [EMAIL PROTECTED] Message-ID: <[EMAIL PROTECTED]> linux-ha CVS committal Author : horms Host : Project : linux-ha Module : ldirectord Dir : linux-ha/ldirectord Modified Files: ldirectord.in Log Message: Emailalerts for purge events Signed-Off-By: Simon Horman <[EMAIL PROTECTED]> =================================================================== RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ldirectord.in 15 Aug 2006 07:14:40 -0000 1.27 +++ ldirectord.in 15 Aug 2006 07:16:11 -0000 1.28 @@ -1,5 +1,5 @@ #!/usr/bin/perl -my($VERSION)=(qw$Id: ldirectord.in,v 1.27 2006/08/15 07:14:40 horms Exp $)[2]; +my($VERSION)=(qw$Id: ldirectord.in,v 1.28 2006/08/15 07:16:11 horms Exp $)[2]; ###################################################################### # ldirectord http://www.vergenet.net/linux/ldirectord/ @@ -3034,10 +3034,13 @@ { my ($v, $rservice, $tag) = (@_); + my $log_arg = "Purged real server ($tag): $rservice (" . + &get_virtual($v) . ")"; + &system_wrapper("$IPVSADM -d $v->{proto} " . &get_virtual($v) . " -r $rservice"); - &ld_log("Purged real server ($tag): " . - "$rservice (" . &get_virtual($v) . ")"); + &ld_log($log_arg); + &ld_emailalert_send($log_arg, $v, $rservice); } ------------------------------ _______________________________________________ Linux-ha-cvs mailing list Linux-ha-cvs@lists.linux-ha.org http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs End of Linux-ha-cvs Digest, Vol 33, Issue 40 ********************************************