Re: stats socket problem

2009-01-21 Thread Willy Tarreau
On Thu, Jan 22, 2009 at 01:01:56AM +0100, Martin Karbon wrote:
> Quoting Willy Tarreau :
> 
> >On Wed, Jan 21, 2009 at 09:43:58PM +0100, Martin Karbon wrote:
> >>Quoting Willy Tarreau :
> >>
> >>Hi Willy, thanks for the fast reply
> >>>Hi Martin,
> >>>
> >>>On Wed, Jan 21, 2009 at 12:13:35PM +0100, Martin Karbon wrote:
> Hi
> I am relatively new to this great software and I am having problems
> with the feature stats socket. it won't write the haproxy.stat file no
> matter what. so I cannot run the "socat".
> r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat
> stdio
> 2009/01/21 12:12:54 socat[4887] E connect(3, AF=1
> "/var/run/haproxy.stat", 23): No such file or directory
> I wanted to try to write some  script that checks the connection
> distribution every n seconds (i.e.for a monitoring tool)... any advice
> for this?
> >>>
> >>>I see nothing wrong in your config. It's so simple! Could you check a
> >>>few things, such as if something already exists in /var/run, if you see
> >>>a symbolic link or anything like this which might explain such a strange
> >>>behaviour.
> >>
> >>As far as I can see no symbolic link in here...just pid files and some 
> >>dirs
> >>
> >>>Also, it would be nice if you could start haproxy under strace :
> >>>
> >>># strace -o /tmp/haproxy-start.log haproxy -db -f /etc/haproxy.cfg
> >>>
> >>>Then press Ctrl-C after a few seconds, and look for "haproxy.stat"
> >>>in the output file (or post the result here). I think we'll find
> >>>the reason there. There must be an error somewhere, or there is
> >>>something disabling the stats but I don't see what can do that.
> >>>
> >>>Regards,
> >>>Willy
> >>
> >>here is the output of the strace (note: this is a virtual machine I
> >>have at home, same installation as the "original" one)
> >
> >(...)
> >
> >now that's rather intriguing. There's no trace of the socket at all.
> >Just as if the "stats" line was ignored.
> >
> >What version of haproxy do you have ? (haproxy -vv)
> 
> r...@lobalix01:/etc# haproxy -vv
> HA-Proxy version 1.3.12 2007/06/17

Funny, as the stats socket was implemented later (was added in 1.3.13
on the 2007/10/17). So I think that the config parser was not strict
enough and did not catch this "stats" keyword. That seems strange, but
it appears to be the case. Another possibility is that your package
includes some backports of later versions which in fact do not work.

(...)
> you thinking the version being the problem ? This is the version I get  
> from  ubuntus repositories ...

Yes I think the problem is with this version. I find it strange that
Ubuntu still has that old version, as other distros have migrated to
1.3.14 or 1.3.15. You should rebuild it from the latest sources (1.3.15.7),
it's not too hard. Just "make TARGET=linux26" and you're OK.

Alternatively, you can download a pre-compiled binary from the
haproxy site (/download/1.3/bin/).

Regards,
Willy




Re: stats socket problem

2009-01-21 Thread Martin Karbon

Quoting Willy Tarreau :


On Wed, Jan 21, 2009 at 09:43:58PM +0100, Martin Karbon wrote:

Quoting Willy Tarreau :

Hi Willy, thanks for the fast reply
>Hi Martin,
>
>On Wed, Jan 21, 2009 at 12:13:35PM +0100, Martin Karbon wrote:
>>Hi
>>I am relatively new to this great software and I am having problems
>>with the feature stats socket. it won't write the haproxy.stat file no
>>matter what. so I cannot run the "socat".
>>r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat
>>stdio
>>2009/01/21 12:12:54 socat[4887] E connect(3, AF=1
>>"/var/run/haproxy.stat", 23): No such file or directory
>>I wanted to try to write some  script that checks the connection
>>distribution every n seconds (i.e.for a monitoring tool)... any advice
>>for this?
>
>I see nothing wrong in your config. It's so simple! Could you check a
>few things, such as if something already exists in /var/run, if you see
>a symbolic link or anything like this which might explain such a strange
>behaviour.

As far as I can see no symbolic link in here...just pid files and some dirs

>Also, it would be nice if you could start haproxy under strace :
>
># strace -o /tmp/haproxy-start.log haproxy -db -f /etc/haproxy.cfg
>
>Then press Ctrl-C after a few seconds, and look for "haproxy.stat"
>in the output file (or post the result here). I think we'll find
>the reason there. There must be an error somewhere, or there is
>something disabling the stats but I don't see what can do that.
>
>Regards,
>Willy

here is the output of the strace (note: this is a virtual machine I
have at home, same installation as the "original" one)


(...)

now that's rather intriguing. There's no trace of the socket at all.
Just as if the "stats" line was ignored.

What version of haproxy do you have ? (haproxy -vv)


r...@lobalix01:/etc# haproxy -vv
HA-Proxy version 1.3.12 2007/06/17
Copyright 2000-2007 Willy Tarreau 
Could you add an error on the "stats" line (insert "foobar" before
"socket") so that you can verify haproxy complains ? If it does
not complain, could you retype the line or at least add one line
with "stats foobar" in order to get the parsing error ?

I'm realizing that I generally add the "stats socket" line
approximately as the last line of the global section. While
it would appear stupid to me, could you please move this line
at the end of the section ? Maybe there's a long standing bug
caused by another parameter clearing this one (but once again,
I'd find that a bit strange).

I prefer easily reproducible errors like this one to non-
deterministic ones !

Regards,
Willy


r...@lobalix01:/etc# cat /etc/haproxy.cfg
global
log 127.0.0.1   local0
log 127.0.0.1   local1 notice
maxconn 4096
user haproxy
group haproxy
stats fooabove socket /var/run/haproxy.above
stats socket /var/run/haproxy.stat mode 600
stats foobelow socket /var/run/haproxy.below
...

when I start
r...@lobalix01:/etc# strace -o /tmp/haproxy-start.log haproxy -db -f  
/etc/haproxy.cfg

no parsing error is shown, whereas the trace is as follows

r...@lobalix01:/etc# cat /tmp/haproxy-start.log
execve("/usr/sbin/haproxy", ["haproxy", "-db", "-f",  
"/etc/haproxy.cfg"], [/* 18 vars */]) = 0

brk(0)  = 0x8072000
access("/etc/ld.so.nohwcap", F_OK)  = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7f14000
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or  
directory)

open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=17937, ...}) = 0
mmap2(NULL, 17937, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f0f000
close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = 0
open("/usr/lib/libpcreposix.so.3", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\6\0"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0644, st_size=5280, ...}) = 0
mmap2(NULL, 8112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,  
0) = 0xb7f0d000
mmap2(0xb7f0e000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xb7f0e000

close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = 0
open("/usr/lib/libpcre.so.3", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\16"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0644, st_size=157240, ...}) = 0
mmap2(NULL, 156036, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,  
0) = 0xb7ee6000
mmap2(0xb7f0c000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26) = 0xb7f0c000

close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = 0
open("/lib/libc.so.6", O_RDONLY)= 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260e\1"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=1274092, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7ee5000
mmap2(NULL, 1279600,

Re: stats socket problem

2009-01-21 Thread Willy Tarreau
On Wed, Jan 21, 2009 at 09:43:58PM +0100, Martin Karbon wrote:
> Quoting Willy Tarreau :
> 
> Hi Willy, thanks for the fast reply
> >Hi Martin,
> >
> >On Wed, Jan 21, 2009 at 12:13:35PM +0100, Martin Karbon wrote:
> >>Hi
> >>I am relatively new to this great software and I am having problems
> >>with the feature stats socket. it won't write the haproxy.stat file no
> >>matter what. so I cannot run the "socat".
> >>r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat
> >>stdio
> >>2009/01/21 12:12:54 socat[4887] E connect(3, AF=1
> >>"/var/run/haproxy.stat", 23): No such file or directory
> >>I wanted to try to write some  script that checks the connection
> >>distribution every n seconds (i.e.for a monitoring tool)... any advice
> >>for this?
> >
> >I see nothing wrong in your config. It's so simple! Could you check a
> >few things, such as if something already exists in /var/run, if you see
> >a symbolic link or anything like this which might explain such a strange
> >behaviour.
> 
> As far as I can see no symbolic link in here...just pid files and some dirs
> 
> >Also, it would be nice if you could start haproxy under strace :
> >
> ># strace -o /tmp/haproxy-start.log haproxy -db -f /etc/haproxy.cfg
> >
> >Then press Ctrl-C after a few seconds, and look for "haproxy.stat"
> >in the output file (or post the result here). I think we'll find
> >the reason there. There must be an error somewhere, or there is
> >something disabling the stats but I don't see what can do that.
> >
> >Regards,
> >Willy
> 
> here is the output of the strace (note: this is a virtual machine I  
> have at home, same installation as the "original" one)

(...)

now that's rather intriguing. There's no trace of the socket at all.
Just as if the "stats" line was ignored.

What version of haproxy do you have ? (haproxy -vv)
Could you add an error on the "stats" line (insert "foobar" before
"socket") so that you can verify haproxy complains ? If it does
not complain, could you retype the line or at least add one line
with "stats foobar" in order to get the parsing error ?

I'm realizing that I generally add the "stats socket" line
approximately as the last line of the global section. While
it would appear stupid to me, could you please move this line
at the end of the section ? Maybe there's a long standing bug
caused by another parameter clearing this one (but once again,
I'd find that a bit strange).

I prefer easily reproducible errors like this one to non-
deterministic ones !

Regards,
Willy




Re: stats socket problem

2009-01-21 Thread Martin Karbon

Quoting Willy Tarreau :

Hi Willy, thanks for the fast reply

Hi Martin,

On Wed, Jan 21, 2009 at 12:13:35PM +0100, Martin Karbon wrote:

Hi
I am relatively new to this great software and I am having problems
with the feature stats socket. it won't write the haproxy.stat file no
matter what. so I cannot run the "socat".
r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat
stdio
2009/01/21 12:12:54 socat[4887] E connect(3, AF=1
"/var/run/haproxy.stat", 23): No such file or directory
I wanted to try to write some  script that checks the connection
distribution every n seconds (i.e.for a monitoring tool)... any advice
for this?


I see nothing wrong in your config. It's so simple! Could you check a
few things, such as if something already exists in /var/run, if you see
a symbolic link or anything like this which might explain such a strange
behaviour.


As far as I can see no symbolic link in here...just pid files and some dirs


Also, it would be nice if you could start haproxy under strace :

# strace -o /tmp/haproxy-start.log haproxy -db -f /etc/haproxy.cfg

Then press Ctrl-C after a few seconds, and look for "haproxy.stat"
in the output file (or post the result here). I think we'll find
the reason there. There must be an error somewhere, or there is
something disabling the stats but I don't see what can do that.

Regards,
Willy


here is the output of the strace (note: this is a virtual machine I  
have at home, same installation as the "original" one)



r...@lobalix01:~# more /tmp/haproxy-start.log
execve("/usr/sbin/haproxy", ["haproxy", "-db", "-f",  
"/etc/haproxy.cfg"], [/* 17 vars */]) = 0

brk(0)  = 0x8072000
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or  
directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7f19000
access("/etc/ld.so.preload", R_OK)  = -1 ENOENT (No such file or  
directory)

open("/etc/ld.so.cache", O_RDONLY)  = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=17937, ...}) = 0
mmap2(NULL, 17937, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f14000
close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or  
directory)

open("/usr/lib/libpcreposix.so.3", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\200\6\0"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0644, st_size=5280, ...}) = 0
mmap2(NULL, 8112, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,  
0) = 0xb7f12000
mmap2(0xb7f13000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0xb7f13000

close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or  
directory)

open("/usr/lib/libpcre.so.3", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\360\16"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0644, st_size=157240, ...}) = 0
mmap2(NULL, 156036, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3,  
0) = 0xb7eeb000
mmap2(0xb7f11000, 4096, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x26) = 0xb7f11000

close(3)= 0
access("/etc/ld.so.nohwcap", F_OK)  = -1 ENOENT (No such file or  
directory)

open("/lib/tls/i686/cmov/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260e\1"...,  
512) = 512

fstat64(3, {st_mode=S_IFREG|0755, st_size=1364388, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7eea000
mmap2(NULL, 1369712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE,  
3, 0) = 0xb7d9b000
mmap2(0xb7ee4000, 12288, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x149) = 0xb7ee4000
mmap2(0xb7ee7000, 9840, PROT_READ|PROT_WRITE,  
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7ee7000

close(3)= 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7d9a000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb7d9a6b0,  
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,  
limit_in_pages:1, seg_not_present:0,

useable:1}) = 0
mprotect(0xb7ee4000, 4096, PROT_READ)   = 0
munmap(0xb7f14000, 17937)   = 0
gettimeofday({1232569710, 612838}, NULL) = 0
brk(0)  = 0x8072000
brk(0x8093000)  = 0x8093000
open("/etc/localtime", O_RDONLY)= 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,  
0) = 0xb7f18000
read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\6\0\0\0\6\0\0"...,  
4096) = 2652

_llseek(3, -28, [2624], SEEK_CUR)   = 0
read(3, "\nCET-1CEST,M3.5.0,M10.5.0/3\n", 4096) = 28
close(3)= 0
munmap(0xb7f18000, 4096)= 0
getpid()= 4727
uname({sys="Linux", node="lobali

Re: stats socket problem

2009-01-21 Thread Willy Tarreau
Hi Martin,

On Wed, Jan 21, 2009 at 12:13:35PM +0100, Martin Karbon wrote:
> Hi
> I am relatively new to this great software and I am having problems  
> with the feature stats socket. it won't write the haproxy.stat file no  
> matter what. so I cannot run the "socat".
> r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat 
> stdio
> 2009/01/21 12:12:54 socat[4887] E connect(3, AF=1  
> "/var/run/haproxy.stat", 23): No such file or directory
> I wanted to try to write some  script that checks the connection  
> distribution every n seconds (i.e.for a monitoring tool)... any advice  
> for this?

I see nothing wrong in your config. It's so simple! Could you check a
few things, such as if something already exists in /var/run, if you see
a symbolic link or anything like this which might explain such a strange
behaviour.

Also, it would be nice if you could start haproxy under strace :

# strace -o /tmp/haproxy-start.log haproxy -db -f /etc/haproxy.cfg

Then press Ctrl-C after a few seconds, and look for "haproxy.stat"
in the output file (or post the result here). I think we'll find
the reason there. There must be an error somewhere, or there is
something disabling the stats but I don't see what can do that.

Regards,
Willy




stats socket problem

2009-01-21 Thread Martin Karbon

Hi
I am relatively new to this great software and I am having problems  
with the feature stats socket. it won't write the haproxy.stat file no  
matter what. so I cannot run the "socat".

r...@lb1:~# echo "show stat" | socat unix-connect:/var/run/haproxy.stat stdio
2009/01/21 12:12:54 socat[4887] E connect(3, AF=1  
"/var/run/haproxy.stat", 23): No such file or directory
I wanted to try to write some  script that checks the connection  
distribution every n seconds (i.e.for a monitoring tool)... any advice  
for this?
My system is running an Ubuntu server 8.04 and my configuration file  
is as follows

r...@lb1:~# cat /etc/haproxy.cfg
global
log 127.0.0.1syslog
log 127.0.0.1kern notice
stats socket /var/run/haproxy.stat mode 600
user haproxy
group haproxy
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 2000
contimeout 5000
clitimeout 5
srvtimeout 5

listen ias 192.168.0.250:80
mode http
stats enable
balance roundrobin
option httpclose
server ias1 192.168.0.201:80 check
server ias2 192.168.0.202:80 check

what am I doing wrong? thanking you in advance

Martin



This message was sent using IMP, the Internet Messaging Program.




stats socket problem

2009-01-21 Thread Martin Karbon

Hi
I am relatively new to this great software and I am having problems  
with the feature stats socket. it won't write the haproxy.stat file no  
matter what
I wanted to try to write some remote executable script that check the  
connection distribution every n seconds...

my configuration file is as follows
r...@balancix1:~# cat /etc/haproxy.cfg
global
log 127.0.0.1   syslog
log 127.0.0.1   kern notice
stats socket /var/run/haproxy.stat mode 600
user haproxy
group haproxy
maxconn 4096
defaults
log global
mode http
option httplog
option dontlognull
retries 3
redispatch
maxconn 2000
contimeout 5000
clitimeout 5
srvtimeout 5

listen ias 192.168.0.250:80
mode http
stats enable
balance roundrobin
option httpclose
server ias1 192.168.0.201:80 check
server ias2 192.168.0.202:80 check

what am I doing wrong? thanking you in advance

Martin


This message was sent using IMP, the Internet Messaging Program.