LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

ldirectord tests for custom apps

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: ldirectord tests for custom apps
From: "Patrick LeBoutillier" <patl@xxxxxxxxxxxx>
Date: Mon, 22 Nov 2004 17:30:47 -0600 (CST)
Hi all,

Here is a small patch (for "Id: ldirectord,v 1.77.2.5 2004/09/13 07:42:41
horms Exp") that allows
ldirectord to load and call code to test custom applications.

The idea is simple: the 'plugins' configuration directive allows the user
to specify a Perl script that will
be require'd. Then when you define a virtual service, you can set
"service" to any value you want as long
as you have defined a function called "check_<service>" in your plugins
file. You can then do whatever you want here as long as you follow what
the checks for the standard services do.

Note: Documentation is missing but I will write it up if the path is
considered.

Note: I have also removed the "()" after the service_set declaration
because it seemed to be interpreted as
a function prototype from the required file.

I have seen some discussions lately on bigger efforts to modularize
ldirectord, but this patch is very small and it works well for me so far.

Any comments/suggestions?

Cheers,

Patrick LeBoutillier


774,775c774,775
<                                           || $1 eq "ftp" || $1 eq "none"
|| $1 eq "smtp" || $1 eq "pop" || $1 eq "imap" || $1 eq "nntp" || $1 eq
"dns")
<                                           or &config_error($line,
"service must be http, https, ftp, smtp, pop, imap, ldap, nntp, dns or
none");
---
>                                           || $1 eq "ftp" || $1 eq "none"
|| $1 eq "smtp" || $1 eq "pop"
|| $1 eq "imap" || $1 eq
"nntp" || $1 eq "dns" ||
defined &{"check_$1"})
>                                           or &config_error($line,
"service must be http, https,
ftp, smtp, pop, imap, ldap,
nntp, dns, none or a
check_service function must
exist");
867a868,872
>               } elsif ($_ =~ /^plugins\s*=\s*(.*)/) {
>                       (-r $1)
>                           or &config_error($line,
>                                       "plugins must be a readeable file
containing perl code");
>                       require $1 ;
1545a1551,1553
>                                       } elsif (defined
&{"check_$$v{service}"}) {
>                                               no strict 'refs' ;
>                                               $$r{num_connects} = 0 if
(&{"check_$$v{service}"}($v,
$r));
2062c2070
< sub service_set()
---
> sub service_set


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