HAProxy community

How can HAProxy report / aggregate back-ends statuses into one judging on their number (2 out of 3 lets say)


#1

Hello

is there a way to aggregate all backends into one status judging based on their statuses?

eg: i have 5 backends, and if 3 out of 5 are down than i want to report a single state as down. Same if 1 is down and 4 are up and status shows UP for the backend.

Thank you


#2

Hello

Can someone help on this?


#3

Clarify what you mean by “single status”?

Do you mean you want to disable a backend completely / show an error, when the amount of backend servers is lower than a certain number?


#4

Hello

I do not want to disable (but if that is possible please let me know) but show Error or DOWN state when the amount is lower than a certain number as you say.
As stated i want to aggregate my back end statuses and not remove them. Meaning to report a single status of them:

eg: I have 5 backend nodes. If 3 of those nodes are down i want to report on the stats that all my backend is down. So i want to combine my backend statuses based on the http check i am doing into a single one.


#5

You can use the nbsrv variable to do all kind’s of things, based on the number of available backend servers.

Like failing a certain monitor uri, or switching to a different backend.

What you cannot do is to fake the actual stats.


#6

monitor fall seems not to be applicable for backend.

May i ask for some config about it?

This is my backend (4 nodes), so should it get it set up?

backend TEST
listen HAproxy_Test
bind XX.XXX.XX.XX:80 v4v6
maxconn 12500
timeout client 6000
timeout server 6000
timeout connect 5000
timeout check 1000
balance roundrobin
option httpchk
option forwardfor
option log-health-checks
mode http
stats enable
option httpchk GET <------------->nAuthorization:\ Basic\ ZZZZZZZZZZZZZZZZZZZZZ
http-check expect string YYY
server GGGGGGGGG.com PP.PP.PPP.PP:8007 check verify none
server GGGGGGGGG.com PP.PP.PPP.PP:8007 check verify none
server GGGGGGGGG.com PP.PP.PPP.PP:8007 check verify none
server GGGGGGGGG.com PP.PP.PPP.PP:8007 check verify none


#7

No, monitor uri/fall has a specific use-case, which may or may not be applicable to your case, which I still don’t really understand.

Like I said, you cannot fake your own stats.