Quoting Willy Tarreau <w#1wt.eu>:
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".
>> root#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)
root#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 ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d9a000
brk(0) = 0x8072000 brk(0x8093000) = 0x8093000 open("/etc/localtime", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f18000
close(3) = 0 munmap(0xb7f18000, 4096) = 0 getpid() = 4727 uname({sys="Linux", node="lobalix01", ...}) = 0 open("/etc/haproxy.cfg", O_RDONLY) = 3fstat64(3, {st_mode=S_IFREG|0644, st_size=652, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f18000
read(3, "global\n log 127.0.0.1 l"..., 4096) = 652 socket(PF_FILE, SOCK_STREAM, 0) = 4 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4) = 0 socket(PF_FILE, SOCK_STREAM, 0) = 4 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4) = 0open("/etc/nsswitch.conf", O_RDONLY) = 4 fstat64(4, {st_mode=S_IFREG|0644, st_size=475, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f17000
read(4, "", 4096) = 0 close(4) = 0 munmap(0xb7f17000, 4096) = 0 open("/etc/ld.so.cache", O_RDONLY) = 4fstat64(4, {st_mode=S_IFREG|0644, st_size=17937, ...}) = 0 mmap2(NULL, 17937, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7d95000
close(4) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(4) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(4) = 0 munmap(0xb7d95000, 17937) = 0 open("/etc/ld.so.cache", O_RDONLY) = 4fstat64(4, {st_mode=S_IFREG|0644, st_size=17937, ...}) = 0 mmap2(NULL, 17937, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7d95000
close(4) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(4) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(4) = 0 munmap(0xb7d95000, 17937) = 0 open("/etc/passwd", O_RDONLY|0x80000 /* O_??? */) = 4 fcntl64(4, F_GETFD) = 0x1 (flags FD_CLOEXEC) _llseek(4, 0, [0], SEEK_CUR) = 0fstat64(4, {st_mode=S_IFREG|0644, st_size=1108, ...}) = 0 mmap2(NULL, 1108, PROT_READ, MAP_SHARED, 4, 0) = 0xb7f17000
_llseek(4, 1108, [1108], SEEK_SET) = 0 munmap(0xb7f17000, 1108) = 0 close(4) = 0 socket(PF_FILE, SOCK_STREAM, 0) = 4 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4) = 0 socket(PF_FILE, SOCK_STREAM, 0) = 4 fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
close(4) = 0 open("/etc/group", O_RDONLY|0x80000 /* O_??? */) = 4 _llseek(4, 0, [0], SEEK_CUR) = 0fstat64(4, {st_mode=S_IFREG|0644, st_size=732, ...}) = 0 mmap2(NULL, 732, PROT_READ, MAP_SHARED, 4, 0) = 0xb7f17000
_llseek(4, 732, [732], SEEK_SET) = 0 munmap(0xb7f17000, 732) = 0 close(4) = 0 read(3, "", 4096) = 0 close(3) = 0 munmap(0xb7f18000, 4096) = 0gettimeofday({1232569710, 647667}, NULL) = 0 mmap2(NULL, 200704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d2e000
rt_sigaction(SIGQUIT, {0x8049c40, [QUIT], SA_RESTART}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGUSR1, {0x8049f00, [USR1], SA_RESTART}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGHUP, {0x8049c60, [HUP], SA_RESTART}, {SIG_DFL}, 8) = 0socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.210")}, 16) = 0
listen(3, 2000) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0 sendto(4, "<141>Jan 21 21:28:30 haproxy[472"..., 56, MSG_DONTWAIT|MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 1
setgid32(113) = 0 setuid32(105) = 0getrlimit(RLIMIT_NOFILE, {rlim_cur=8205, rlim_max=8205}) = 0 gettimeofday({1232569710, 654370}, NULL) = 0 select(4, [3], NULL, NULL, {2, 2297}) = 0 (Timeout) gettimeofday({1232569712, 662481}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.123")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {0, 991334}) = 0 (Timeout) gettimeofday({1232569713, 661559}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.124")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {0, 998000}) = 0 (Timeout) gettimeofday({1232569714, 674739}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.123")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {0, 992218}) = ? ERESTARTNOHAND (To be restarted) --- SIGINT (Interrupt) @ 0 (0) ---
I saw some errors regarding /var/run/nscd/socket so I installed nscd and got the directory with this content
root#lobalix01:~# ls -lahtr /var/run/nscd/ total 4.0K
drwxr-xr-x 9 root root 440 2009-01-21 21:19 .. srw-rw-rw- 1 root root 0 2009-01-21 21:35 socket -rw-r--r-- 1 root root 5 2009-01-21 21:35 nscd.pid drwxr-xr-x 2 root root 80 2009-01-21 21:35 .
but still no trace of the /var/run/haproxy.stats socket one more strace after the nscd install
root#lobalix01:~# cat /root/haproxy-start-with-nscd.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 ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file ordirectory)
close(3) = 0mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7e13000
brk(0) = 0x8072000 brk(0x8093000) = 0x8093000 open("/etc/localtime", O_RDONLY) = 3 fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0fstat64(3, {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f91000
close(3) = 0 munmap(0xb7f91000, 4096) = 0 getpid() = 4775 uname({sys="Linux", node="lobalix01", ...}) = 0 open("/etc/haproxy.cfg", O_RDONLY) = 3fstat64(3, {st_mode=S_IFREG|0644, st_size=652, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f91000
read(3, "global\n log 127.0.0.1 l"..., 4096) = 652 socket(PF_FILE, SOCK_STREAM, 0) = 4fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0 send(4, "\2\0\0\0\v\0\0\0\7\0\0\0passwd\0", 19, MSG_NOSIGNAL) = 19 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1
mmap2(NULL, 217016, PROT_READ, MAP_SHARED, 5, 0) = 0xb7dde000 close(5) = 0 close(4) = 0 socket(PF_FILE, SOCK_STREAM, 0) = 4fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0 connect(4, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = 0 send(4, "\2\0\0\0\f\0\0\0\6\0\0\0group\0", 18, MSG_NOSIGNAL) = 18 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP, revents=POLLIN|POLLHUP}], 1, 5000) = 1
mmap2(NULL, 217016, PROT_READ, MAP_SHARED, 5, 0) = 0xb7da9000 close(5) = 0 close(4) = 0 read(3, "", 4096) = 0 close(3) = 0 munmap(0xb7f91000, 4096) = 0gettimeofday({1232570385, 396624}, NULL) = 0 mmap2(NULL, 200704, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7d78000
rt_sigaction(SIGQUIT, {0x8049c40, [QUIT], SA_RESTART}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGUSR1, {0x8049f00, [USR1], SA_RESTART}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGHUP, {0x8049c60, [HUP], SA_RESTART}, {SIG_DFL}, 8) = 0socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 fcntl64(3, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.210")}, 16) = 0
listen(3, 2000) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 4stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2652, ...}) = 0 sendto(4, "<141>Jan 21 21:39:45 haproxy[477"..., 56, MSG_DONTWAIT|MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(514), sin_addr=inet_addr("127.0.0.1")}, 16) = 56 sendto(4, "<133>Jan 21 21:39:45 haproxy[477"..., 56, MSG_DONTWAIT|MSG_NOSIGNAL, {sa_family=AF_INET, sin_port=htons(514),
sin_addr=inet_addr("127.0.0.1")}, 16) = 56 rt_sigaction(SIGTTOU, {0x8049ed0, [TTOU], SA_RESTART}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGTTIN, {0x8049eb0, [TTIN], SA_RESTART}, {SIG_DFL}, 8) = 0 setrlimit(RLIMIT_NOFILE, {rlim_cur=8205, rlim_max=8205}) = 0 setgid32(113) = 0 setuid32(105) = 0getrlimit(RLIMIT_NOFILE, {rlim_cur=8205, rlim_max=8205}) = 0 gettimeofday({1232570385, 403469}, NULL) = 0 select(4, [3], NULL, NULL, {2, 2155}) = 0 (Timeout) gettimeofday({1232570387, 414078}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.123")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {0, 988737}) = 0 (Timeout) gettimeofday({1232570388, 402326}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.124")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {1, 18157}) = 0 (Timeout) gettimeofday({1232570389, 421121}, NULL) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 fcntl64(5, F_SETFL, O_RDONLY|O_NONBLOCK) = 0 setsockopt(5, SOL_TCP, TCP_NODELAY, [1], 4) = 0 connect(5, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("192.168.1.123")}, 16) = -1 EINPROGRESS (Operation now in progress)
close(5) = 0select(4, [3], NULL, NULL, {0, 987167}) = ? ERESTARTNOHAND (To be restarted) --- SIGINT (Interrupt) @ 0 (0) ---
Thanking you for your time
Martin
This archive was generated by hypermail 2.2.0 : 2009/01/21 21:45 CET