Refs #5385 : Removed Realm
This commit is contained in:
parent
75f2a46926
commit
3b5b2f43eb
|
@ -60,7 +60,6 @@ sub new {
|
|||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"path:s" => { name => 'path', default => '/manager/text/list' },
|
||||
"realm:s" => { name => 'realm', default => 'Tomcat Manager Application' },
|
||||
"name:s" => { name => 'name' },
|
||||
"regexp" => { name => 'use_regexp' },
|
||||
"regexp-isensitive" => { name => 'use_regexpi' },
|
||||
|
@ -204,10 +203,6 @@ Specify username for basic authentification (Mandatory if --credentials is speci
|
|||
|
||||
Specify password for basic authentification (Mandatory if --credentials is specidied)
|
||||
|
||||
=item B<--realm>
|
||||
|
||||
Credentials Realm (Default: 'Tomcat Manager Application')
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Threshold for HTTP timeout
|
||||
|
|
|
@ -43,43 +43,32 @@ use LWP::UserAgent;
|
|||
|
||||
sub connect {
|
||||
my ($self, %options) = @_;
|
||||
my $ua = LWP::UserAgent->new( protocols_allowed => ['http','https'], timeout => $self->{option_results}->{timeout});
|
||||
my $ua = LWP::UserAgent->new( protocols_allowed => ['http', 'https'], timeout => $self->{option_results}->{timeout});
|
||||
my $connection_exit = defined($options{connection_exit}) ? $options{connection_exit} : 'unknown';
|
||||
|
||||
my $response;
|
||||
my $content;
|
||||
my ($response, $content);
|
||||
|
||||
if (defined $self->{option_results}->{credentials}) {
|
||||
#$ua->credentials($self->{option_results}->{hostname}.':'.$self->{option_results}->{port},$self->{option_results}->{username},$self->{option_results}->{password});
|
||||
$ua->credentials($self->{option_results}->{hostname}.':'.$self->{option_results}->{port},$self->{option_results}->{realm},$self->{option_results}->{username},$self->{option_results}->{password});
|
||||
my $req = HTTP::Request->new( GET => $self->{option_results}->{proto}."://" .$self->{option_results}->{hostname}.':'.$self->{option_results}->{port}.$self->{option_results}->{path});
|
||||
|
||||
if (defined($self->{option_results}->{credentials})) {
|
||||
$req->authorization_basic($self->{option_results}->{username}, $self->{option_results}->{password});
|
||||
}
|
||||
|
||||
if ($self->{option_results}->{proto} eq "https") {
|
||||
if (defined $self->{option_results}->{proxyurl}) {
|
||||
$ua->proxy(['https'], $self->{option_results}->{proxyurl});
|
||||
$response = $ua->get('https://'.$self->{option_results}->{hostname}.':'.$self->{option_results}->{port}.$self->{option_results}->{path});
|
||||
} else {
|
||||
$response = $ua->get('https://'.$self->{option_results}->{hostname}.':'.$self->{option_results}->{port}.$self->{option_results}->{path});
|
||||
}
|
||||
} else {
|
||||
if (defined $self->{option_results}->{proxyurl}) {
|
||||
$ua->proxy(['http'], $self->{option_results}->{proxyurl});
|
||||
$response = $ua->get($self->{option_results}->{proto}."://" .$self->{option_results}->{hostname}.$self->{option_results}->{path});
|
||||
} else {
|
||||
$response = $ua->get('http://'.$self->{option_results}->{hostname}.':'.$self->{option_results}->{port}.$self->{option_results}->{path});
|
||||
}
|
||||
if (defined($self->{option_results}->{proxyurl})) {
|
||||
$ua->proxy(['http', 'https'], $self->{option_results}->{proxyurl});
|
||||
}
|
||||
|
||||
$response = $ua->request($req);
|
||||
|
||||
if ($response->is_success) {
|
||||
if ($response->is_success) {
|
||||
$content = $response->content;
|
||||
return $content;
|
||||
} else {
|
||||
$self->{output}->output_add(severity => $connection_exit,
|
||||
short_msg => $response->status_line);
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => $connection_exit,
|
||||
short_msg => $response->status_line);
|
||||
$self->{output}->display();
|
||||
$self->{output}->exit();
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -60,7 +60,6 @@ sub new {
|
|||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"path:s" => { name => 'path', default => '/manager/text/list' },
|
||||
"realm:s" => { name => 'realm', default => 'Tomcat Manager Application' },
|
||||
"filter-name:s" => { name => 'filter_name', },
|
||||
"filter-state:s" => { name => 'filter_state', },
|
||||
"filter-path:s" => { name => 'filter_path', },
|
||||
|
@ -181,10 +180,6 @@ Specify username for basic authentification (Mandatory if --credentials is speci
|
|||
|
||||
Specify password for basic authentification (Mandatory if --credentials is specidied)
|
||||
|
||||
=item B<--realm>
|
||||
|
||||
Credentials Realm (Default: 'Tomcat Manager Application')
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Threshold for HTTP timeout
|
||||
|
|
|
@ -60,7 +60,6 @@ sub new {
|
|||
"proxyurl:s" => { name => 'proxyurl' },
|
||||
"timeout:s" => { name => 'timeout', default => '3' },
|
||||
"path:s" => { name => 'path', default => '/manager/text/list' },
|
||||
"realm:s" => { name => 'realm', default => 'Tomcat Manager Application' },
|
||||
"warning:s" => { name => 'warning' },
|
||||
"critical:s" => { name => 'critical' },
|
||||
"name:s" => { name => 'name' },
|
||||
|
@ -207,10 +206,6 @@ Specify username for basic authentification (Mandatory if --credentials is speci
|
|||
|
||||
Specify password for basic authentification (Mandatory if --credentials is specidied)
|
||||
|
||||
=item B<--realm>
|
||||
|
||||
Credentials Realm (Default: 'Tomcat Manager Application')
|
||||
|
||||
=item B<--timeout>
|
||||
|
||||
Threshold for HTTP timeout
|
||||
|
|
Loading…
Reference in New Issue