Xymon Mailing List Archive search

Querying xymond with perl socket

list Olivier Audry
Tue, 15 Nov 2011 15:59:54 +0100 (CET)
Message-Id: <user-801a900b99b0@xymon.invalid>

hello

as I understand your script send information from the client to the server. It's not what I'm doing. I trying to get information from the server to create a customer portal "sexy web 2.0 in da cloud".

oau

----- Mail d'origine -----
De: Buchan Milne <user-9b139aff4dec@xymon.invalid>
À: xymon at xymon.com
Cc: Olivier AUDRY <user-0dc286edb094@xymon.invalid>
Envoyé: Tue, 15 Nov 2011 15:33:46 +0100 (CET)
Objet: Re: [Xymon] Querying xymond with perl socket

On Tuesday, 15 November 2011 14:09:30 Olivier AUDRY wrote:
hello

I need to do a xymondboard directly with tcp. nc is working :

echo "hobbitdboard host=xxxxx test=ping" | nc xxx.xxx.xxx.xxx  1984

is working. But my perl code is not working :

#!/usr/bin/perl -w
use strict;
use IO::Socket;

$| = 1;

my $sock = new IO::Socket::INET (
                                PeerAddr => 'xxx.xxx.xxx.xxx',
                                PeerPort => '1984',
                                Proto    => 'tcp',
) or warn "Cannot connect to xymon : $!\n";

print $sock "hobbitdboard host=xxxx test=ping\n";

my $answer = <$sock>;
print "$answer\n";


close ($sock);
Rather than everyone implement their own Hobbit/Xymon communication, wouldn't 
it be better to ship standard modules (whether with the Xymon distribution, or 
elsewhere).

I attach the module I worked on a while back, which one of my tests uses:

http://staff.telkomsa.net/~bgmilne/xymon/

Here is a simple script that demonstrates its use:
http://staff.telkomsa.net/~bgmilne/xymon/bb.pl

It would be nice if various people working on perl modules could agree to a 
naming convention and feature set, and implement one set of interoperating 
modules ...

Regards,
Buchan