[Xymon] Querying xymond with perl socket

Olivier AUDRY olivier at audry.fr
Tue Nov 15 14:23:32 CET 2011


hello

thx for your suggestion but when I use nc in a fake hobbit server it's working :)


nc -l 1984 receive my query and I can respond to my xymon.pl script and I can see the answer.

I'll have a look to your url.

oau


----- Mail d'origine -----
De: pkc mls <pkc_mls at yahoo.fr>
À: xymon at xymon.com
Envoyé: Tue, 15 Nov 2011 14:17:13 +0100 (CET)
Objet: Re: [Xymon] Querying xymond with perl socket

Le 15/11/2011 13:09, Olivier AUDRY a écrit :
> hello
Hi,
> 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);
>
> Someone can help me ?
looks like you have to read the sock before you can print it;
please find below an example in french with sockets
http://www.dil.univ-mrs.fr/~chris/Perl/Sockets.htm
> thx
>
> oau
>
bon courage
_______________________________________________
Xymon mailing list
Xymon at xymon.com
http://lists.xymon.com/mailman/listinfo/xymon




More information about the Xymon mailing list