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)


----------------------------------------------------------------------

Message: 1
Date: Mon, 14 Aug 2006 21:29:26 -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:
ldirectord: doctor version

Doctor version, as 1.n -> 1.(n + 144) the code was maintained as
ldirectord in CVS up until version 1.144, then the file was renamed to
ldirectord, so the counter reset to 1.1.  Its probably better to manage
the version number a completely different way, however this has worked
well enough in the past, and the following munging should suffice for now

Signed-Off-By: Simon Horman <[EMAIL PROTECTED]>

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- ldirectord.in       14 Aug 2006 19:59:35 -0000      1.1
+++ ldirectord.in       15 Aug 2006 03:29:25 -0000      1.2
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord.in,v 1.1 2006/08/14 19:59:35 msoffen Exp $)[2];
+my($VERSION)=(qw$Id: ldirectord.in,v 1.2 2006/08/15 03:29:25 horms Exp $)[2];
 
 ######################################################################
 # ldirectord                 http://www.vergenet.net/linux/ldirectord/
@@ -456,6 +456,17 @@
 $RUNPID           = "/var/run/ldirectord";
 $QUIESCENT        = "yes";
 
+
+# Doctor version, as 1.n -> 1.(n + 144) the code was maintained as
+# ldirectord in CVS up until version 1.144, then the file was renamed to
+# ldirectord, so the counter reset to 1.1.  Its probably better to manage
+# the version number a completely different way, however this has worked
+# well enough in the past, and the following munging should suffice for now
+if ($VERSION =~ m/1\.([0-9]+)/) {
+       $VERSION = $1 + 144;
+       $VERSION = "1.$VERSION";
+}
+
 $CRLF = "\x0d\x0a";
 
 use Getopt::Long;




------------------------------

Message: 2
Date: Mon, 14 Aug 2006 21:30:47 -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:
Make the emailalert and emailalertfreq options global as well as non-global

Signed-off-by: Simon Horman <[EMAIL PROTECTED]>

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ldirectord.in       15 Aug 2006 03:29:25 -0000      1.2
+++ ldirectord.in       15 Aug 2006 03:30:46 -0000      1.3
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-my($VERSION)=(qw$Id: ldirectord.in,v 1.2 2006/08/15 03:29:25 horms Exp $)[2];
+my($VERSION)=(qw$Id: ldirectord.in,v 1.3 2006/08/15 03:30:46 horms Exp $)[2];
 
 ######################################################################
 # ldirectord                 http://www.vergenet.net/linux/ldirectord/
@@ -171,6 +171,24 @@
 The default is to log directly to the file I</var/log/ldirectord.log>.
 
 
+B<emailalert = ">I<emailaddress>B<">
+
+A valid email address for sending alerts about the changed connection status
+to any real server defined in the virtual service.  This option requires
+perl module MailTools to be installed.  Automatically tries to send email
+using any of the built-in methods. See perldoc Mail::Mailer for more info on
+methods.
+
+B<emailalertfreq => I<n>
+
+
+Delay in seconds between repeating email alerts while any given real server
+in the virtual service remains inaccessible.  A setting of zero seconds will
+inhibit the repeating alerts.  Default setting is zero.  The email timing
+accuracy of this setting is dependent on the number of seconds defined in
+the checkinterval configuration option.
+
+
 B<execute = ">I<configuration>B<">
 
 Use this directive to start an instance of ldirectord for
@@ -225,9 +243,10 @@
 string starts with I<http://...> the IP-address and port of the real server is
 overridden, otherwise the IP-address and port of the real server is used.
 
-=head2 More than one of these entries may be inside a virtual section.
-The quiescent and fallback options listed above may also appear inside
-a virtual section, in which case the global setting is overridden.
+=head2 More than one of these entries may be inside a virtual section.  The
+fallback, emailalert, emailalertfreq and quiescent options listed above may
+also appear inside a virtual section, in which case the global setting is
+overridden.
 
 B<checktype = >I<negotiate>|I<connect>|I<N>|I<ping>|I<off>|I<on>
 
@@ -362,22 +381,6 @@
 then it must be one of tcp or udp and will default to tcp. If a firewall
 mark then the protocol must be fwm, which is the default.
 
-B<emailalert = ">I<emailaddress>B<">
-
-A valid email address for sending alerts about the changed connection status
-to any real server defined in the virtual service.  This option requires
-perl module MailTools to be installed.  Automatically tries to send email
-using any of the built-in methods. See perldoc Mail::Mailer for more info on
-methods.
-
-B<emailalertfreq => I<n>
-
-Delay in seconds between repeating email alerts while any given real server
-in the virtual service remains inaccessible.  A setting of zero seconds will
-inhibit the repeating alerts.  Default setting is zero.  The email timing
-accuracy of this setting is dependent on the number of seconds defined in
-the checkinterval configuration option.
-
 =head1 FILES
 
 B<@sysconfdir@/ldirectord.cf>
@@ -415,6 +418,8 @@
            $RUNPID
            $CHECKTIMEOUT
            $QUIESCENT
+           $EMAILALERT
+           $EMAILALERTFREQ
 
            $CALLBACK
            $CFGNAME
@@ -455,7 +460,29 @@
 $NEGOTIATETIMEOUT = 0;
 $RUNPID           = "/var/run/ldirectord";
 $QUIESCENT        = "yes";
+$EMAILALERT      = "";
+$EMAILALERTFREQ          = 0;
+
 
+# Doctor version, as 1.n -> 1.(n + 144) the code was maintained as
+# ldirectord in CVS up until version 1.144, then the file was renamed to
+# ldirectord, so the counter reset to 1.1.  Its probably better to manage
+# the version number a completely different way, however this has worked
+# well enough in the past, and the following munging should suffice for now
+if ($VERSION =~ m/1\.([0-9]+)/) {
+       $VERSION = $1 + 144;
+       $VERSION = "1.$VERSION";
+}
+
+# Doctor version, as 1.n -> 1.(n + 144) the code was maintained as
+# ldirectord in CVS up until version 1.144, then the file was renamed to
+# ldirectord, so the counter reset to 1.1.  Its probably better to manage
+# the version number a completely different way, however this has worked
+# well enough in the past, and the following munging should suffice for now
+if ($VERSION =~ m/1\.([0-9]+)/) {
+       $VERSION = $1 + 144;
+       $VERSION = "1.$VERSION";
+}
 
 # Doctor version, as 1.n -> 1.(n + 144) the code was maintained as
 # ldirectord in CVS up until version 1.144, then the file was renamed to
@@ -831,8 +858,6 @@
                        $vsrv{negotiatetimeout} = 0;
                        $vsrv{num_connects} = 0;
                        $vsrv{httpmethod} = "GET";
-                       $vsrv{emailalert} = "";
-                       $vsrv{emailalertfreq} = 0;
                        push(@VIRTUAL, \%vsrv);
                        while(<CFGFILE>) {
                                $line++;
@@ -1063,6 +1088,14 @@
                            or &config_error($line, 
                                        "quiescent must be 'yes' or 'no'");
                        $QUIESCENT = $1;
+               } elsif  ($_ =~ /^emailalert\s*=\s*(.*)/) {
+                       $1 =~ /(.+)/ or &config_error($line,
+                                       "no email address specified");
+                       $EMAILALERT = $1;
+               } elsif  ($_ =~ /^emailalertfreq\s*=\s*(\d*)/) {
+                       $1 =~ /(\d+)/ or &config_error($line,
+                                       "invalid email alert frequency");
+                       $EMAILALERTFREQ = $1;
                } else {
                        if ($_ =~ /^timeout\s*=\s*(.*)/) {
                                &config_error($line, 
@@ -1678,8 +1711,18 @@
                        my $real_str = "$nr->{server}:$nr->{port}";
                        my %emailstat;
                        $emailstat{server}=$real_str . " " . $nv->{server} . 
":" . $nv->{port};
-                       $emailstat{emailalertfreq}=$nv->{emailalertfreq};
-                       $emailstat{emailalert}=$nv->{emailalert};
+                       if (defined $nv->{emailalertfreq}) {
+                               
$emailstat{emailalertfreq}=$nv->{emailalertfreq};
+                       } 
+                       else {
+                               $emailstat{emailalertfreq}=$EMAILALERTFREQ;
+                       }
+                       if (defined $nv->{emailalert}) {
+                               $emailstat{emailalert}=$nv->{emailalert};
+                       }
+                       else {
+                               $emailstat{emailalert}=$EMAILALERT;
+                       }
                        push(@EMAILSTATUS, \%emailstat);                        
                        if (! defined($or->{$real_str}) or
                                        $or->{$real_str}->{weight} == 0) {
@@ -3046,6 +3089,9 @@
        my $emailfh;
        my $status = 0;
 
+       if (not defined $emailto) {
+               $emailto = $EMAILALERT;
+       }
        if ($emailto eq "") {
                return 0;
        }




------------------------------

_______________________________________________
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 31
********************************************

Reply via email to