Re: Reading haproxy statistics via Perl

From: Krzysztof Oledzki <ole#ans.pl>
Date: Fri, 20 Feb 2009 17:00:27 +0100 (CET)

On Thu, 19 Feb 2009, Maria wrote:

> Hi once again,

Hi,

> Sorry for my previous weired posting. Now I formulated my code cleaner.
> My question was:
>
> I am trying to read the information logged from haproxy (e.g. show info, show stat) from the socket using
> perl.
> My intention is to read out the information in a similar manner as the command "socat" is doing, like:
> echo "show stat" | /usr/local/bin/socat /var/lib/haproxy-stat stdio
>
> The problem is when I am accessing to the socket for reading some information, nothing is printed out into
> stdout. I also found under the source folder of haproxy a similar perl script what uses nmtp. I do not
> believe that I need nmtp for my purpose, isn't it?

You meant snmp right? No, obviously you don't need snmp but you may still consider using it as it provides everything what you need to setup monitoring with nagios.

> Does somebody has any idea, what I am doing wrong?

Yep:

> my $sock = new IO::Socket::UNIX (
>      LocalAddr => "/var/run/haproxy.socket",
s/LocalAddr/Peer/

Besr regards,

                         Krzysztof Olędzki Received on 2009/02/20 17:00

This archive was generated by hypermail 2.2.0 : 2009/02/20 18:15 CET