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);
Someone can help me ?
thx
oau
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
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
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);
You need to call the "shutdown" method before trying to read the data, to tell xymond that you are not going to send any more data - only then will the response come back from xymond. Something like "shutdown($sock, 1);" (1 = SHUT_WR according to my man-page).
Regards, Henrik
that's great !! many thx
oau ----- Mail d'origine ----- De: Henrik Størner <henrik at hswn.dk> À: xymon at xymon.com Envoyé: Tue, 15 Nov 2011 15:19:59 +0100 (CET) Objet: Re: [Xymon] Querying xymond with perl socket
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);
You need to call the "shutdown" method before trying to read the data, to tell xymond that you are not going to send any more data - only then will the response come back from xymond. Something like "shutdown($sock, 1);" (1 = SHUT_WR according to my man-page).
Regards, Henrik
Xymon mailing list Xymon at xymon.com http://lists.xymon.com/mailman/listinfo/xymon
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
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 <bgmilne at staff.telkomsa.net> À: xymon at xymon.com Cc: Olivier AUDRY <olivier at audry.fr> 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
On Tuesday, 15 November 2011 16:59:54 Olivier AUDRY wrote:
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".
It pulls data out too:
[bgmilne at tiger lib]$ PERL5LIB=pwd perl bb.pl localhost 'hobbitdboard
test=conn'
$VAR1 = [
'bgmilne-pc|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|801550|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn
NOT ok ',
'localhost|conn|green|OrdAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov 15 17:50:21 2011 conn ok
',
'printer|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|348830|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn
NOT ok ',
'tiger.ranger.dnsalias.com|conn|green|OrdAstLe|1321339551|
1321372239|1321374039|0|0|127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov
15 17:50:21 2011 conn ok '
];
But, you don't have to just dump the data with Data::Dumper, the example bb.pl just does that to show how the data is returned by the Xymon::Client object.
Yes, I also want to biuld a sexy customer web 2.0 portal. Why should everyone have to build their own ones, when we could at least cooperate on the components, even if we don't cooperate on the actual portal.
Regards, Buchan
On Tuesday, 15 November 2011 17:56:40 Buchan Milne wrote:
On Tuesday, 15 November 2011 16:59:54 Olivier AUDRY wrote:
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".
It pulls data out too:
[bgmilne at tiger lib]$ PERL5LIB=
pwdperl bb.pl localhost 'hobbitdboard test=conn' $VAR1 = [ 'bgmilne-pc|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0| 127.0.0.1|801550|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn NOT ok ', 'localhost|conn|green|OrdAstLe|1321339551|1321372239|1321374039|0|0| 127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov 15 17:50:21 2011 conn ok ', 'printer|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0| 127.0.0.1|348830|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn NOT ok ', 'tiger.ranger.dnsalias.com|conn|green|OrdAstLe|1321339551| 1321372239|1321374039|0|0|127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov 15 17:50:21 2011 conn ok ' ];But, you don't have to just dump the data with Data::Dumper, the example bb.pl just does that to show how the data is returned by the Xymon::Client object.
Yes, I also want to biuld a sexy customer web 2.0 portal. Why should everyone have to build their own ones, when we could at least cooperate on the components, even if we don't cooperate on the actual portal.
For me, the next step would be to look at writing a Catalyst::Model::Xymon using Xymon::Client.
But, then I would actually like to write Catalyst app that can be re-used (along with other ones that we have at various levels of completion), but CatalystX::Features doesn't seem to be doing what I want.
Regards, Buchan
Yes, I also want to biuld a sexy customer web 2.0 portal. Why should everyone have to build their own ones, when we could at least cooperate on the components, even if we don't cooperate on the actual portal.
Because we need to implement this regarding what is already existing in the compagny.
For my exemple I need to link the portal with the cmdb, the KB, the ticketing and the monitoring.
For exemple here is a few fonction I will use :
those are working :
get_group_by_host() to get the name of the group compress for an host like database or application server etc. get_hosts_by_plids() to get the hosts for a given plateform id get_plids_by_customer() to get all the plateform id for one customer get_hosts_by_customer() to get all the hosts for a customer. Should be useless.
those will work :
get the country for an host get the datacenter for an host get the test list for an host get the status for a test for an hosts get the type and os for a device.
with this I think I can do something great.
oau
----- Mail d'origine ----- De: Buchan Milne <bgmilne at staff.telkomsa.net> À: Olivier AUDRY <olivier at audry.fr> Cc: xymon at xymon.com Envoyé: Tue, 15 Nov 2011 16:56:40 +0100 (CET) Objet: Re: [Xymon] Querying xymond with perl socket
On Tuesday, 15 November 2011 16:59:54 Olivier AUDRY wrote:
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".
It pulls data out too:
[bgmilne at tiger lib]$ PERL5LIB=pwd perl bb.pl localhost 'hobbitdboard
test=conn'
$VAR1 = [
'bgmilne-pc|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|801550|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn
NOT ok ',
'localhost|conn|green|OrdAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov 15 17:50:21 2011 conn ok
',
'printer|conn|red|ordAstLe|1321339551|1321372239|1321374039|0|0|
127.0.0.1|348830|red <!-- [flags:ordAstLe] --> Tue Nov 15 17:50:21 2011 conn
NOT ok ',
'tiger.ranger.dnsalias.com|conn|green|OrdAstLe|1321339551|
1321372239|1321374039|0|0|127.0.0.1|-1|green <!-- [flags:OrdAstLe] --> Tue Nov
15 17:50:21 2011 conn ok '
];
But, you don't have to just dump the data with Data::Dumper, the example bb.pl just does that to show how the data is returned by the Xymon::Client object.
Yes, I also want to biuld a sexy customer web 2.0 portal. Why should everyone have to build their own ones, when we could at least cooperate on the components, even if we don't cooperate on the actual portal.
Regards, Buchan
On Tuesday, 15 November 2011 19:24:44 Olivier AUDRY wrote:
Yes, I also want to biuld a sexy customer web 2.0 portal. Why should everyone have to build their own ones, when we could at least cooperate on the components, even if we don't cooperate on the actual portal.
Because we need to implement this regarding what is already existing in the compagny.
For my exemple I need to link the portal with the cmdb, the KB, the ticketing and the monitoring.
For exemple here is a few fonction I will use :
those are working :
get_group_by_host() to get the name of the group compress for an host like database or application server etc. get_hosts_by_plids() to get the hosts for a given plateform id get_plids_by_customer() to get all the plateform id for one customer get_hosts_by_customer() to get all the hosts for a customer. Should be useless.
those will work :
get the country for an host get the datacenter for an host
So this is specific to your CMDB.
get the test list for an host
This one still needs to be written, but I don't really want to duplicate configuration parsing code (and I believe Xymon should consider supporting multiple configuration backends, so a perl module here should really be an XS module for a library interfact).
get the status for a test for an hosts
My Xymon::Client should already give you this.
get the type and os for a device.
with this I think I can do something great.
Of course there will be information regarding a host outside Xymon, but the point is to have standard modules that support the Xymon aspects, that can be re-used by multiple projects.
Regards, Buchan
participants (4)
-
bgmilne@staff.telkomsa.net
-
henrik@hswn.dk
-
olivier@audry.fr
-
pkc_mls@yahoo.fr