sherbertpunt has asked for the wisdom of the Perl Monks concerning the following question:
I am tring to write a new script using use LWP::UserAgent
#!/usr/bin/perl -w use strict; use warnings; use LWP::UserAgent; use JSON qw( decode_json ); use Data::Dumper; use Nagios::Plugin; use FindBin qw($Bin); use lib "$Bin/../lib"; my $jboss_url = 'http://admin:jboss@10.208.30.77:9990/management/?oper +ation=resource&name=server-state&include-runtime=true&json.pretty'; my $ua = LWP::UserAgent->new; $ua->credentials('10.208.30.77:9990','something','admin','jboss'); my $response = $ua->get ( $jboss_url ); print $response; my $json = $response->decoded_content; print Dumper $json;
My problem is i am getting the following error and I am not sure how to fix it..
./check_jboss_state.pl HTTP::Response=HASH(0x1448eb0)$VAR1 = 'Server closed connection withou +t sending any data back at /usr/local/nagios/perl/lib/Net/HTTP/Method +s.pm line 345. ';
An Update i have now got it working... and here's how needless to say it was my lack of understanding... In the end I amended
my $jboss_url = 'http://admin:jboss@10.208.30.77:9990/management/?oper +ation=resource&name=server-state&include-runtime=true&json.pretty';
To
$jboss_url = 'http://10.208.30.77:9990/management/?operation=resource& +name=server-state&include-runtime=true&json.pretty';
and this
$ua->credentials('10.208.30.77:9990','something','admin','jboss');
to this
All is well again$ua->credentials('10.208.30.77:9990','ManagementRealm','admin','jboss' +);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Server closed connection without sending any data back
by blue_cowdawg (Monsignor) on Feb 26, 2013 at 13:42 UTC | |
Re: Server closed connection without sending any data back
by sundialsvc4 (Abbot) on Feb 26, 2013 at 13:27 UTC |
Back to
Seekers of Perl Wisdom