dataplaneapi
dataplaneapi copied to clipboard
Add ipv4 stats socket support
uname -a
Linux b02.example.com 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
haproxy -vv
HA-Proxy version 2.0.3 2019/07/23 - https://haproxy.org/
Build options :
TARGET = linux-glibc
CPU = generic
CC = gcc
CFLAGS = -O2 -g -fno-strict-aliasing -DTCP_USER_TIMEOUT=18
OPTIONS = USE_PCRE=1 USE_PCRE_JIT=1 USE_REGPARM=1 USE_LINUX_TPROXY=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1
Feature list : +EPOLL -KQUEUE -MY_EPOLL -MY_SPLICE +NETFILTER +PCRE +PCRE_JIT -PCRE2 -PCRE2_JIT +POLL -PRIVATE_CACHE +THREAD -PTHREAD_PSHARED +REGPARM -STATIC_PCRE -STATIC_PCRE2 +TPROXY +LINUX_TPROXY +LINUX_SPLICE +LIBCRYPT +CRYPT_H -VSYSCALL +GETADDRINFO +OPENSSL -LUA +FUTEX +ACCEPT4 -MY_ACCEPT4 +ZLIB -SLZ +CPU_AFFINITY +TFO +NS +DL +RT -DEVICEATLAS -51DEGREES -WURFL +SYSTEMD -OBSOLETE_LINKER +PRCTL +THREAD_DUMP -EVPORTS
Default settings :
bufsize = 16384, maxrewrite = 1024, maxpollevents = 200
Built with multi-threading support (MAX_THREADS=64, default=8).
Built with OpenSSL version : OpenSSL 1.1.1c 28 May 2019
Running on OpenSSL version : OpenSSL 1.1.1c 28 May 2019
OpenSSL library supports TLS extensions : yes
OpenSSL library supports SNI : yes
OpenSSL library supports : TLSv1.0 TLSv1.1 TLSv1.2 TLSv1.3
Built with network namespace support.
Built with transparent proxy support using: IP_TRANSPARENT IPV6_TRANSPARENT IP_FREEBIND
Built with zlib version : 1.2.7
Running on zlib version : 1.2.7
Compression algorithms supported : identity("identity"), deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
Built with PCRE version : 8.32 2012-11-30
Running on PCRE version : 8.32 2012-11-30
PCRE library supports JIT : yes
Encrypted password support via crypt(3): yes
Available polling systems :
epoll : pref=300, test result OK
poll : pref=200, test result OK
select : pref=150, test result OK
Total: 3 (3 usable), will use epoll.
Available multiplexer protocols :
(protocols marked as <default> cannot be specified using 'proto' keyword)
h2 : mode=HTX side=FE|BE mux=H2
h2 : mode=HTTP side=FE mux=H2
<default> : mode=HTX side=FE|BE mux=H1
<default> : mode=TCP|HTTP side=FE|BE mux=PASS
Available services : none
Available filters :
[SPOE] spoe
[COMP] compression
[CACHE] cache
[TRACE] trace
dataplaneapi -v
HAProxy Data Plane API v1.1.0 c716ebf.dev
Build from: https://github.com/haproxytech/dataplaneapi.git
Build date: 2019-07-26T09:22:47
When running the dataplaneapi with the following configuration set in haproxy, dataplaneapi complains about the ipv4 socket existing and won't return data:
haproxy.cfg:
global
ssl-mode-async
log /dev/log local0 debug
log 127.0.0.1 local1 debug
maxconn 4096
user haproxy
group haproxy
daemon
tune.ssl.default-dh-param 2048
node lb02.example.com
stats socket /run/haproxy.sock user haproxy group haproxy mode 660 level admin
stats socket [email protected]:3333 level admin
master-worker
spread-checks 2
mailers mta
mailer smtp.example.com 192.168.3.26:25
if i GET
http://haproxy.example.com:5555/v1/services/haproxy/stats/native?type=server&parent=internet_443&name=web07
the response is:
{"code":500,"message":"dial unix [email protected]:3333: connect: no such file or directory"}
We currently do not support ipv4 stats sockets. Only unix sockets. We will add this to the roadmap. Also, better error handling would help here also. Where you get the data from the first socket, and ignore the failed one.
Is there a way to make it ignore the ipv4 socket and only use the existing unix socket? I've tried changing the order of the sockets listed, but if any ipv4 socket is listed, it won't operate?
Not currently, I'll fix this before the coming release.
Please checkout latest release (https://github.com/haproxytech/dataplaneapi/releases/tag/v1.2.0) it should be fixed for now before we add support for ipv4 stats sockets.
I tested with the 1.2.0 binary today and it is still failing if you have both a socket and a ip address defined
stats socket /apps/haproxy/bin/admin.sock mode 660 level admin expose-fd listeners
stats socket 127.0.0.1:14567
bin/dataplaneapi -v
HAProxy Data Plane API v1.2.0 5753cad
Build from: [email protected]:haproxytech/dataplaneapi.git
Build date: 2019-08-08T15:53:50
For me this config returns stats from the stats socket and for the second socket returns, only it returns status code 500 in this case, cause the request failed:
{
"error": "dial unix 127.0.0.1:2000: connect: no such file or directory",
"runtimeAPI": "127.0.0.1:2000",
"stats": null
}
When getting a list of sockets I ignore the ones starting with "ipv4@" but maybe I should parse it for IP:port strings and ignore those too.
For reference, this issue above has been solved since October 2019. But unix sockets are still the only type supported.