HAProxy has no ops-mode commands at all

This is sort of a two-part bug. Or, rather, a trivial bug and then an extremely basic feature request.

First, load-balancing haproxy (in 1.5) has no ops-mode (show, etc) commands at all right now, probably because the commit to rename reverse-proxy to haproxy mis-named the ops-mode XML file; it dropped the .xml from the filename.

Second, even without that bug, however, there’s basically no way to know what’s happening under the hood with HAProxy with VyOS. It’ll probably tell you if backends are healthy, but connection rates, errors, etc are all completely invisible. I just ran a load test and shoved 120k requests per second through HAProxy on VyOS, and the backend for show haproxy (/usr/libexec/vyos/op_mode/load-balancing_haproxy.py show) shows no traffic at all:

/usr/libexec/vyos/op_mode/load-balancing_haproxy.py  show
Proxy name    Role      Status    Req rate    Resp time    Last change
------------  --------  --------  ----------  -----------  -------------
web80         FRONTEND  OPEN      0
web443        FRONTEND  OPEN      0
web80         BACKEND   UP                    0 ms         27m29s
web443        BACKEND   UP                    0 ms         27m29s
web80         web1      UP                    0 ms         27m29s
web80         web2      UP                    0 ms         27m29s
web443        web1      UP                    0 ms         27m29s
web443        web2      UP                    0 ms         27m29s

top shows that haproxy on this machine was burning 14 cores at the time, so I’m pretty sure it was involved. I’ve verified that it at least reports health-check status right, but that’s about all that it seems to do usefully. What is the point of an un-managed, un-managable proxy? Can we at least add a simple way to expose HAProxy’s stats interface on a specific IP/port?

if you want to introduce an idea o feature , i will recommend use the https://vyos.dev/ and create the proper feature request with the op-command.

Sure, but there is absolutely a bug here, where the linked commit broke show haproxy.

Thanks, I’ve made a task for the typo: ⚓ T7187 haproxy op-mode missing after rename

and task for the broken stats: ⚓ T7188 haproxy op-mode not reporting correct usage stats

I didn’t look deeply but is seems we cannot get correct information via haproxy socket
It is necessary to investigate it.

I do not see any problems in the my simple test
conf

set load-balancing haproxy backend bk01 server srv01 address '192.168.122.16'
set load-balancing haproxy backend bk01 server srv01 port '8000'
set load-balancing haproxy service web backend 'bk01'
set load-balancing haproxy service web port '80'

check

vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/load-balancing_haproxy.py  show
Proxy name    Role      Status    Req rate    Resp time    Last change
------------  --------  --------  ----------  -----------  -------------
web           FRONTEND  OPEN      4
bk01          BACKEND   UP                    1 ms         5m2s
bk01          srv01     no check              1 ms         5m2s
vyos@r14:~$ 

script for checking

$ cat /tmp/send_curl.sh 
#!/usr/bin/env bash

while true; do
    curl -s http://192.168.122.14 > /dev/null
    sleep 0.2
done

The same with two services

vyos@r14# run show haproxy 
Proxy name    Role      Status    Req rate    Resp time    Last change
------------  --------  --------  ----------  -----------  -------------
https         FRONTEND  OPEN      4
web           FRONTEND  OPEN      8
bk01          BACKEND   UP                    0 ms         4m9s
bk01          srv01     UP                    1 ms         4m9s
bk01          srv02     UP                    1 ms         4m9s
[edit]
vyos@r14#

You should check if the server can respond to the statistic request:

echo "show stat json" | sudo socat /run/haproxy/admin.sock stdio | jq