LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

LDIRECTORD: Add oracle check

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: LDIRECTORD: Add oracle check
Cc: Roberto Nibali <rnibali@xxxxxxxxx>
Cc: J.Libak@xxxxxxxxxx
Cc: Roberto Nibali <ratz@xxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Tue, 24 Apr 2007 19:02:05 +0900
Cc: Roberto Nibali <ratz@xxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: heartbeat/ldirectord/ldirectord.in
===================================================================
--- heartbeat.orig/ldirectord/ldirectord.in     2007-04-24 18:17:16.000000000 
+0900
+++ heartbeat/ldirectord/ldirectord.in  2007-04-24 18:17:52.000000000 +0900
@@ -300,7 +300,7 @@ checking will take place and no real or 
 On means no checking will take place and real servers will always be
 activated. Default is I<negotiate>.
 
-B<service => 
B<dns>|B<ftp>|B<http>|B<https>|B<imap>|B<imaps>|B<ldap>|B<mysql>|B<nntp>|B<none>|B<pgsql>|B<pop>|B<pops>|B<radius>|B<sip>|B<smtp>
+B<service => 
B<dns>|B<ftp>|B<http>|B<https>|B<imap>|B<imaps>|B<ldap>|B<mysql>|B<nntp>|B<none>|B<oracle>|B<pgsql>|B<pop>|B<pops>|B<radius>|B<sip>|B<smtp>
 
 The type of service to monitor when using checktype=negotiate. None denotes
 a service that will not be monitored. 
@@ -332,6 +332,8 @@ Default:
 
 =item * Virtual server port is 995: pops
 
+=item * Virtual server port is 1521: oracle
+
 =item * Virtual server port is 1812: radius
 
 =item * Virtual server port is 3306: mysql
@@ -368,7 +370,7 @@ overridden by an optional per real-serve
 For a DNS check this should the name of an A record, or the address
 of a PTR record to look up.
 
-For a MySQL or PostgeSQL checks, this should be a SQL query.
+For a MySQL, Oracle and PostgeSQL checks, this should be a SQL query.
 The data returned is not checked, only that the
 answer is one or more rows.  This is a required setting.
 
@@ -403,7 +405,8 @@ As a last resort the IP address of the r
 
 B<login = ">I<username>B<">
 
-Username to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL.
+For FTP, IMAP, LDAP, MySQL, Oracle, POP and PostgreSQL, the username
+used to log in.
 
 For Radius the passwd is used for the attribute User-Name.
 
@@ -416,7 +419,7 @@ Default:
 
 =item * FTP: Anonymous
 
-=item * MySQL and PostgreSQL: Must be specified in the configuration
+=item * MySQL Oracle, and PostgreSQL: Must be specified in the configuration
 
 =item * SIP: ldirectord\@<hostname>, hostname is derived as per the passwd
         option below.
@@ -428,7 +431,7 @@ Default:
 
 B<passwd = ">I<password>B<">
 
-Password to use to login to FTP, IMAP, LDAP, MySQL, POP, PostgreSQL
+Password to use to login to FTP, IMAP, LDAP, MySQL, Oracle, POP, PostgreSQL
 and SIP servers.
 
 For Radius the passwd is used for the attribute User-Password.
@@ -442,16 +445,16 @@ Default:
        run time, or sourced from uname if unset.
 
 =item * Otherwise: empty string.
-       In the case of LDAP, MySQL and PostgreSQL this means
+       In the case of LDAP, MySQL, Oracle, and PostgreSQL this means
        that authentication will not be performed.
 
 =back 4
 
 B<database = ">I<databasename>B<">
 
-Database to use for MySQL and PostgreSQL servers, this is the database that
-the query (set by B<receive> above) will be performed against.  This is a
-required setting.
+Database to use for MySQL, Oracle and PostgreSQL servers, this is the
+database that the query (set by B<receive> above) will be performed
+against.  This is a required setting.
 
 B<secret = ">I<radiussecret>B<">
 
@@ -1169,6 +1172,7 @@ sub read_config
                                                          $1 eq "nntp"  ||
                                                          $1 eq "mysql" ||
                                                          $1 eq "none"  ||
+                                                         $1 eq "oracle"||
                                                          $1 eq "pop"   ||
                                                          $1 eq "pops"  ||
                                                          $1 eq "radius"||
@@ -1182,6 +1186,7 @@ sub read_config
                                                             "imap, imaps, " .
                                                             "ldap, nntp, "  .
                                                             "mysql, none, " .
+                                                            "oracle, "      .
                                                             "pop, pops, "   .
                                                             "radius, "      .
                                                             "pgsql, sip "   .
@@ -1429,6 +1434,9 @@ sub _ld_read_config_virtual_resolve
                        elsif ($vsrv->{port} eq "5432") {
                                $vsrv->{service} = "pgsql";
                        } 
+                       elsif ($vsrv->{port} eq "1521") {
+                               $vsrv->{service} = "oracle";
+                       }
                        elsif ($vsrv->{port} eq "5060") {
                                $vsrv->{service} = "sip";
                        } 
@@ -2106,6 +2114,8 @@ sub ld_main
                                                $$r{num_connects} = 0 if 
(check_pgsql($v, $r));
                                        } else {
                                                $$r{num_connects} = 0 if 
(check_none($v, $r));
+                                       } elsif ($$v{service} eq "oracle") {
+                                               $$r{num_connects} = 0 if 
(check_oracle($v, $r));
                                        }
                                } elsif ($$v{checktype} eq "connect") {
                                        if ($$v{protocol} ne "udp") {
@@ -2505,6 +2515,11 @@ sub check_pgsql
        return check_sql(@_, "Pg", "dbname");
 }
 
+sub check_oracle
+{
+       return check_sql(@_, "Oracle", "");
+}
+
 sub check_sql
 {
        require DBI;
@@ -2516,7 +2531,7 @@ sub check_sql
        $query =~ s#^/##;
        unless ($$v{login} && $query) {
                &ld_log("Error: Must specify a login and request string " .
-                       "for MySQL and PostgreSQL checks. " .
+                       "for MySQL, Oracle and PostgreSQL checks. " .
                        "Not adding $$r{server}.\n");
                goto err_down;
        }

-- 

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/


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