Is there a way to cat only yellow shards in haproxy.cfg?

Hello fellas!

I would like to have yellow shards for one of my backend configs. Right now I have this one:

backend blabla
mode tcp
balance roundrobin
option httpchk get /_cat/indices
http-check expect rstring \b(green|yellow)\b
server s1 someip1:9222 check port 9201 inter 12000 rise 2 fall 2
server s2 someip2:9222 check port 9201 inter 12000 rise 2 fall 2
server s3 someip3:9222 check port 9201 inter 12000 rise 2 fall 2

I want something like /indices/health=yellow (i know it's wrong this way) but I can't find anything like this through the dox. Any help is much appreciated!

Hi rogue,

You can specify which header of the _cat API you want. For example, to show the health header:


Does it work for you?


Yes, perfect!

Actually, can i do the same for /_cluster/health but instead of the whole json I would like to receive whether it is green or yellow? I can't use stuff like cut or awk ..

Hi Rogue,

In the last example http://localhost:9200/_cat/indices?h=health the result is the indices health.

Now you are asking for cluster health, which you be http://localhost:9200/_cat/health?h=status.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.