Re: Read stat or info from the socket via perl

From: Guillaume Bourque <Guillaume.Bourque#gmail.com>
Date: Fri, 20 Feb 2009 09:48:58 -0500


Hi,

just do it in bash it works well for me.

Bye

Maria a écrit :
> Dear Willy,
>
> I don't have a lot of experience in perl to. As Nagios allows also to do
> this via bash or c, I can also use this. My main goal is only to read
> this information with a language (supported by nagios) and send them to
> nagios server. It does not matter if it is Perl or not.
>
> BTW. I modified a little the code, but I am still not able to read out
> this information. Maybe I will try in C code.
>
> i read from the manual that it is possible to write out statistics into
> a csv file? Do I specify this in the configuration file?
>
> Thanks
>
> ##############################
> ####################
>
> #! /usr/bin/perl -w
>
>
> use strict;
> use IO::Socket;
> #
> use lib "/usr/local/nagios/libexec";
> #
>
> my $sock = new IO::Socket::UNIX (
> Local => "/var/run/haproxy.socket.7739.tmp",
> Type => SOCK_STREAM,
> Listen => 2)
> or die 'error on connection.';
>
> next if !$sock;
>
> print $sock "show info \012";
>
> print "Now printing sockets information \n";
> while(<$sock>){
> print;
> }
>
> $sock->close;
>
> ##################################################

-- 
Guillaume Bourque, B.Sc.,
consultant, infrastructures technologiques libres !
514 576-7638
Received on 2009/02/20 15:48

This archive was generated by hypermail 2.2.0 : 2009/02/20 17:00 CET