Hi, I've been using ldirectord for years with no problems. Recently, I moved the matching to using a firewall mark so that we can manage all ports on a particular virtual IP rather than just a few nominated ports. This works well, but leaves me unable to monitor all the relevant ports from within ldirectord. For example, I can't monitor a web server running http and https.
"No problem", thought I, "I can just use an external checkcommand and hand that the list of ports I'd like to monitor". But I can't. There's no facility to pass extra command line arguments to the checking script. Please see the attached patch file, which implements a "checkarg" setting. If a checkarg is specified then it's supplied as a fifth argument to the checkcommand script (both for external and external-perl). I'd really appreciate it if you considered it worth adding to ldirectord... Incidentally, I think there's a bug relating to checkport and checkcommand scripts. The scripts are always handed the virtual service port rather than the value of checkport if specified. I'd have thought it should be the latter. Cheers, Alun. -- Alun Jones, [email protected], 01970 622494 Gwasanaethau Gwybodaeth / Information Services Prifysgol Aberystwyth / Aberystwyth University
*** ldirectord.in.new Fri Jul 13 15:01:31 2012
--- ldirectord.in Fri Jul 13 15:01:45 2012
***************
*** 525,538 ****
exit code conventions are identical to checktype external. That is, an
external-perl checktype should also work as an external checktype.
Default: /bin/true
- B<checkarg = ">I<extra arg to checkcommand>B<">
-
- If this value is set, it is passed as an extra fifth argument to checkcommand.
-
B<checkport = >I<n>
Number of port to monitor. Sometimes check port differs from service port.
Default: port specified for each real server
--- 525,534 ----
***************
*** 1306,1316 ****
$vsrv{port} = "0";
}
$vsrv{real} = \@rsrv;
$vsrv{scheduler} = "wrr";
$vsrv{checkcommand} = "/bin/true";
- $vsrv{checkarg} = undef;
$vsrv{request} = "/";
$vsrv{receive} = "";
$vsrv{login} = "";
$vsrv{passwd} = "";
$vsrv{database} = "";
--- 1302,1311 ----
***************
*** 1356,1368 ****
&config_error($line, "checktype must be \"connect\", \"negotiate\", \"on\", \"off\", \"ping\", \"external\", \"external-perl\" or a positive number");
}
} elsif ($rcmd =~ /^checkcommand\s*=\s*\"(.*)\"/ or $rcmd =~ /^checkcommand\s*=\s*(.*)/){
$1 =~ /(.+)/ or &config_error($line, "invalid check command");
$vsrv{checkcommand} = $1;
- } elsif ($rcmd =~ /^checkarg\s*=\s*\"(.*)\"/ or $rcmd =~ /^checkarg\s*=\s*(.*)/){
- $1 =~ /(.+)/ or &config_error($line, "invalid check arg");
- $vsrv{checkarg} = $1;
} elsif ($rcmd =~ /^checktimeout\s*=\s*(.*)/){
$1 =~ /(\d+)/ && $1 or &config_error($line, "invalid check timeout");
$vsrv{checktimeout} = $1;
} elsif ($rcmd =~ /^connecttimeout\s*=\s*(.*)/){
&config_error($line,
--- 1351,1360 ----
***************
*** 3166,3179 ****
$v_server = $$v{server};
} else {
$v_server = $$v{fwm};
}
! my @args = ($$v{checktimeout}, $$v{checkcommand},
! $v_server, $$v{port}, $$r{server}, $$r{port});
! push(@args, $$v{checkarg}) if (defined($$v{checkarg}));
! my $result = system_timeout(@args);
if ($result) {
&service_set($v, $r, "down", {do_log => 1});
&ld_debug(3, "Deactivated service $$r{server}:$$r{port}: " .
"$@ after calling $$v{checkcommand} with result " .
--- 3158,3170 ----
$v_server = $$v{server};
} else {
$v_server = $$v{fwm};
}
! my $result = system_timeout($$v{checktimeout},
! $$v{checkcommand}, $v_server, $$v{port},
! $$r{server}, $$r{port});
if ($result) {
&service_set($v, $r, "down", {do_log => 1});
&ld_debug(3, "Deactivated service $$r{server}:$$r{port}: " .
"$@ after calling $$v{checkcommand} with result " .
***************
*** 3212,3224 ****
no warnings 'redefine';
local *CORE::GLOBAL::exit = sub {
$result = shift;
goto external_exit;
};
! my @args = ($v_server, $$v{port}, $$r{server}, $$r{port});
! push(@args, $$v{checkarg}) if (defined($$v{checkarg}));
! $cmdfunc->(@args);
external_exit:
alarm 0;
};
if ($@ or $result != 0) {
&service_set($v, $r, "down");
--- 3203,3213 ----
no warnings 'redefine';
local *CORE::GLOBAL::exit = sub {
$result = shift;
goto external_exit;
};
! $cmdfunc->($v_server, $$v{port}, $$r{server}, $$r{port});
external_exit:
alarm 0;
};
if ($@ or $result != 0) {
&service_set($v, $r, "down");
signature.asc
Description: PGP signature
_______________________________________________ Please read the documentation before posting - it's available at: http://www.linuxvirtualserver.org/ LinuxVirtualServer.org mailing list - [email protected] Send requests to [email protected] or go to http://lists.graemef.net/mailman/listinfo/lvs-users
