Re: haproxy and stats not working :(

From: Willy Tarreau <w#1wt.eu>
Date: Mon, 17 Mar 2008 22:42:22 +0100


Hi Guillaume,

On Mon, Mar 17, 2008 at 01:52:03PM -0400, Guillaume Bourque wrote:
> Hello !
>
> I'm having hard time figuring out how to get the stats, I would need some
> help to resolve 2 issues.
>
> My configuration: debian 8.04 dev, haproxy version
> haproxy-1.3.14.3-pcre-40kses-splice-linux-i586 and
> haproxy_1.3.12.dfsg-1_i386.deb
>
> Here is my config file
> global
> # mettre -r ds /etc/default/syslogd pour accepter le syslog
> log 127.0.0.1 local0 debug
> #log loghost local0 info
> stats socket /tmp/stats
> maxconn 4096
> debug
> #quiet
> user haproxy
> group haproxy
> defaults
> log global
> option tcplog
> #gb option dontlognull
> retries 3
> maxconn 2000
> contimeout 5000
> clitimeout 14400000
> srvtimeout 14400000
>
> listen stats 192.168.4.24:80
> mode http
> option httpclose
> stats enable
> stats uri /

Here, you need to add "balance", because a listen entry cannot have no server. In the past (v1.0 days, when "balance" did not exist), the common behaviour was to have static servers only, which is still the default case. You had to enter a "dispatch" address, which is still supported and which should go away IMHO. Since you have none of them, haproxy complains. A trick is already there to accept "balance" with no server specifically to handle this case :-)

> listen rdpfarm :3389
> mode tcp
> balance source
> # keep alive vers client et le serveur
> option tcpka
> server RDP-1 192.168.4.111:3389 check port 3300
> server RDP-1bk 192.168.4.111:3389 check port 3389 backup
> server RDP-2 192.168.4.201:3389 check port 3300
> server RDP-2bk 192.168.4.201:3389 check port 3389 backup
>
> 1) I have one tcp instance working fine under haproxy I would like to create
> a listen section just for the stats as per the doc but when I do so I get
> this error on haproxy startup
>
> /etc/init.d/haproxy start
> * Starting haproxy
> haproxy
> [ALERT] 076/112852 (1445) : parsing /etc/haproxy.cfg : proxy 'stats' has no
> dispatch address and is not in transparent or balance mode.

see above for "balance"

> 2) Is there a shell example that I could used to ask haproxy to dump the csv
> stat to a file ? I have configure the "stats socket /tmp/stats" option but
> don't know how to get the data ouf of it ?

we're using "socat" for this :

# echo "show stat" | socat unix-connect:/tmp/stats stdio # echo "show info" | socat unix-connect:/tmp/stats stdio

It works like a charm. If you don't have it though, I don't know how you could connect there (unless you're willing to write your own tools).

Regards,
Willy Received on 2008/03/17 22:42

This archive was generated by hypermail 2.2.0 : 2008/03/17 23:00 CET