Xymon Mailing List Archive search

Querying xymond with perl socket

list Buchan Milne
Tue, 15 Nov 2011 16:33:46 +0200
Message-Id: <user-306bd5ac6fe7@xymon.invalid>

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