A few minutes ago I said:
>
> Please see the attached patch file, which implements a "checkarg"
> setting.

Dear all,

Sorry for the noise - I attached the wrong patch on my previous message (it
was against an old version of ldirectord). This one's against the version
I've downloaded from 

http://hg.linux-ha.org/agents/raw-file/926526c374c6/ldirectord/ldirectord.in

which is, I believe, the latest version.

Cheers,
Alun.

-- 
Alun Jones,    [email protected],    01970 622494
Gwasanaethau Gwybodaeth / Information Services  
Prifysgol Aberystwyth / Aberystwyth University
*** ldirectord.in.orig	Fri Jul 13 15:11:55 2012
--- ldirectord.in	Fri Jul 13 15:15:04 2012
***************
*** 529,538 ****
--- 529,542 ----
  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
***************
*** 1338,1347 ****
--- 1342,1352 ----
  			}
  			$vsrv{addressfamily} = $af;
  			$vsrv{real} = \@rsrv;
  			$vsrv{scheduler} = "wrr";
  			$vsrv{checkcommand} = "/bin/true";
+ 			$vsrv{checkarg} = undef;
  			$vsrv{request} = "/";
  			$vsrv{receive} = "";
  			$vsrv{login} = "";
  			$vsrv{passwd} = "";
  			$vsrv{database} = "";
***************
*** 1391,1400 ****
--- 1396,1408 ----
  						&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,
***************
*** 3257,3269 ****
  		$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 " .
--- 3265,3278 ----
  		$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 " .
***************
*** 3302,3312 ****
  		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");
--- 3311,3323 ----
  		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");

Attachment: 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

Reply via email to