RE: Read stat or info from the socket via perl

From: Maria <vmwaretest09#gmail.com>
Date: Fri, 20 Feb 2009 11:56:53 +0100


 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;

##################################################
Received on 2009/02/20 11:56

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