Hi folks!
I've found a problem that really locks my team so the problem that external 
check don't have any opportunity to receive server check port  and can work 
only with server's main port.
So I've made several small changes in and looks at least partially I can build 
an app inside ubuntu container on my Mac.
Can anyone help me with contribution of this feature? Added a snippet with my 
changes above.

diff --git a/doc/configuration.txt b/doc/configuration.txt
index 269d75738..d18ef0b67 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -11148,40 +11148,43 @@ external-check command <command>
   Some values are also provided through environment variables.
   Environment variables :
-    HAPROXY_PROXY_ADDR      The first bind address if available (or empty if 
not
-                            applicable, for example in a "backend" section).
+    HAPROXY_PROXY_ADDR         The first bind address if available (or empty 
if not
+                               applicable, for example in a "backend" section).
-    HAPROXY_PROXY_ID        The backend id.
+    HAPROXY_PROXY_ID           The backend id.
-    HAPROXY_PROXY_NAME      The backend name.
+    HAPROXY_PROXY_NAME         The backend name.
-    HAPROXY_PROXY_PORT      The first bind port if available (or empty if not
-                            applicable, for example in a "backend" section or
-                            for a UNIX socket).
+    HAPROXY_PROXY_PORT         The first bind port if available (or empty if 
not
+                               applicable, for example in a "backend" section 
or
+                               for a UNIX socket).
-    HAPROXY_SERVER_ADDR     The server address.
+    HAPROXY_SERVER_ADDR        The server address.
-    HAPROXY_SERVER_CURCONN  The current number of connections on the server.
+    HAPROXY_SERVER_CURCONN     The current number of connections on the server.
-    HAPROXY_SERVER_ID       The server id.
+    HAPROXY_SERVER_ID          The server id.
-    HAPROXY_SERVER_MAXCONN  The server max connections.
+    HAPROXY_SERVER_MAXCONN     The server max connections.
-    HAPROXY_SERVER_NAME     The server name.
+    HAPROXY_SERVER_NAME        The server name.
-    HAPROXY_SERVER_PORT     The server port if available (or empty for a UNIX
-                            socket).
+    HAPROXY_SERVER_PORT        The server port if available (or empty for a 
UNIX
+                               socket).
-    HAPROXY_SERVER_SSL      "0" when SSL is not used, "1" when it is used
+    HAPROXY_SERVER_CHECK_PORT  The server port if available (or empty for a 
UNIX
+                               socket).
-    HAPROXY_SERVER_PROTO    The protocol used by this server, which can be one
-                            of "cli" (the haproxy CLI), "syslog" (syslog TCP
-                            server), "peers" (peers TCP server), "h1" (HTTP/1.x
-                            server), "h2" (HTTP/2 server), or "tcp" (any other
-                            TCP server).
+    HAPROXY_SERVER_SSL         "0" when SSL is not used, "1" when it is used
-    PATH                    The PATH environment variable used when executing
-                            the command may be set using "external-check path".
+    HAPROXY_SERVER_PROTO       The protocol used by this server, which can be 
one
+                               of "cli" (the haproxy CLI), "syslog" (syslog TCP
+                               server), "peers" (peers TCP server), "h1" 
(HTTP/1.x
+                               server), "h2" (HTTP/2 server), or "tcp" (any 
other
+                               TCP server).
+
+    PATH                       The PATH environment variable used when 
executing
+                               the command may be set using "external-check 
path".
   See also "2.3. Environment variables" for other variables.
diff --git a/src/extcheck.c b/src/extcheck.c
index c667b1635..9a7130aa8 100644
--- a/src/extcheck.c
+++ b/src/extcheck.c
@@ -72,6 +72,7 @@ enum {
        EXTCHK_HAPROXY_SERVER_ID,       /* the server id */
        EXTCHK_HAPROXY_SERVER_ADDR,     /* the server address */
        EXTCHK_HAPROXY_SERVER_PORT,     /* the server port if available (or 
empty) */
+       EXTCHK_HAPROXY_SERVER_CHECK_PORT,       /* the server port health check 
port (or empty) */
        EXTCHK_HAPROXY_SERVER_MAXCONN,  /* the server max connections */
        EXTCHK_HAPROXY_SERVER_CURCONN,  /* the current number of connections on 
the server */
        EXTCHK_HAPROXY_SERVER_SSL,      /* "1" if the server supports SSL, 
otherwise zero */
@@ -81,19 +82,20 @@ enum {
};
 const struct extcheck_env extcheck_envs[EXTCHK_SIZE] = {
-       [EXTCHK_PATH]                   = { "PATH",                   
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_PROXY_NAME]     = { "HAPROXY_PROXY_NAME",     
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_PROXY_ID]       = { "HAPROXY_PROXY_ID",       
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_PROXY_ADDR]     = { "HAPROXY_PROXY_ADDR",     
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_PROXY_PORT]     = { "HAPROXY_PROXY_PORT",     
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_SERVER_NAME]    = { "HAPROXY_SERVER_NAME",    
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_SERVER_ID]      = { "HAPROXY_SERVER_ID",      
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_SERVER_ADDR]    = { "HAPROXY_SERVER_ADDR",    
EXTCHK_SIZE_ADDR },
-       [EXTCHK_HAPROXY_SERVER_PORT]    = { "HAPROXY_SERVER_PORT",    
EXTCHK_SIZE_UINT },
-       [EXTCHK_HAPROXY_SERVER_MAXCONN] = { "HAPROXY_SERVER_MAXCONN", 
EXTCHK_SIZE_EVAL_INIT },
-       [EXTCHK_HAPROXY_SERVER_CURCONN] = { "HAPROXY_SERVER_CURCONN", 
EXTCHK_SIZE_ULONG },
-       [EXTCHK_HAPROXY_SERVER_SSL]     = { "HAPROXY_SERVER_SSL",     
EXTCHK_SIZE_UINT },
-       [EXTCHK_HAPROXY_SERVER_PROTO]   = { "HAPROXY_SERVER_PROTO",   
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_PATH]                      = { "PATH",                      
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_PROXY_NAME]        = { "HAPROXY_PROXY_NAME",        
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_PROXY_ID]          = { "HAPROXY_PROXY_ID",          
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_PROXY_ADDR]        = { "HAPROXY_PROXY_ADDR",        
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_PROXY_PORT]        = { "HAPROXY_PROXY_PORT",        
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_SERVER_NAME]       = { "HAPROXY_SERVER_NAME",       
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_SERVER_ID]         = { "HAPROXY_SERVER_ID",         
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_SERVER_ADDR]       = { "HAPROXY_SERVER_ADDR",       
EXTCHK_SIZE_ADDR },
+       [EXTCHK_HAPROXY_SERVER_PORT]       = { "HAPROXY_SERVER_PORT",       
EXTCHK_SIZE_UINT },
+       [EXTCHK_HAPROXY_SERVER_CHECK_PORT] = { "HAPROXY_SERVER_CHECK_PORT", 
EXTCHK_SIZE_UINT },
+       [EXTCHK_HAPROXY_SERVER_MAXCONN]    = { "HAPROXY_SERVER_MAXCONN",    
EXTCHK_SIZE_EVAL_INIT },
+       [EXTCHK_HAPROXY_SERVER_CURCONN]    = { "HAPROXY_SERVER_CURCONN",    
EXTCHK_SIZE_ULONG },
+       [EXTCHK_HAPROXY_SERVER_SSL]        = { "HAPROXY_SERVER_SSL",        
EXTCHK_SIZE_UINT },
+       [EXTCHK_HAPROXY_SERVER_PROTO]      = { "HAPROXY_SERVER_PROTO",      
EXTCHK_SIZE_EVAL_INIT },
};
 void block_sigchld(void)
@@ -337,6 +339,7 @@ int prepare_external_check(struct check *check)
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_ID, ultoa_r(s->puid, buf, 
sizeof(buf)), err);
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_ADDR, check->argv[3], err);
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_PORT, check->argv[4], err);
+       EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_CHECK_PORT, 
ultoa_r(check->port, buf, sizeof(buf)), err);
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_MAXCONN, ultoa_r(s->maxconn, 
buf, sizeof(buf)), err);
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_CURCONN, 
ultoa_r(s->cur_sess, buf, sizeof(buf)), err);
        EXTCHK_SETENV(check, EXTCHK_HAPROXY_SERVER_SSL, s->use_ssl ? "1" : "0", 
err);

Reply via email to