diff --git a/apps/apache/serverstatus/mode/cpuload.pm b/apps/apache/serverstatus/mode/cpuload.pm index 32e46e0c6..c06b43479 100644 --- a/apps/apache/serverstatus/mode/cpuload.pm +++ b/apps/apache/serverstatus/mode/cpuload.pm @@ -51,7 +51,7 @@ sub new { $options{options}->add_options(arguments => { "hostname:s" => { name => 'hostname' }, - "port:s" => { name => 'port', default => '80' }, + "port:s" => { name => 'port', }, "proto:s" => { name => 'proto', default => "http" }, "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, diff --git a/apps/apache/serverstatus/mode/requests.pm b/apps/apache/serverstatus/mode/requests.pm index 17d3eed6f..4902b1220 100644 --- a/apps/apache/serverstatus/mode/requests.pm +++ b/apps/apache/serverstatus/mode/requests.pm @@ -52,7 +52,7 @@ sub new { $options{options}->add_options(arguments => { "hostname:s" => { name => 'hostname' }, - "port:s" => { name => 'port', default => '80' }, + "port:s" => { name => 'port', }, "proto:s" => { name => 'proto', default => "http" }, "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, diff --git a/apps/apache/serverstatus/mode/responsetime.pm b/apps/apache/serverstatus/mode/responsetime.pm index 121142b4c..ec8c06364 100644 --- a/apps/apache/serverstatus/mode/responsetime.pm +++ b/apps/apache/serverstatus/mode/responsetime.pm @@ -52,7 +52,7 @@ sub new { $options{options}->add_options(arguments => { "hostname:s" => { name => 'hostname' }, - "port:s" => { name => 'port', default => '80' }, + "port:s" => { name => 'port', }, "proto:s" => { name => 'proto', default => "http" }, "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, diff --git a/apps/apache/serverstatus/mode/slotstates.pm b/apps/apache/serverstatus/mode/slotstates.pm index 1f62d0fe0..f012f33d2 100644 --- a/apps/apache/serverstatus/mode/slotstates.pm +++ b/apps/apache/serverstatus/mode/slotstates.pm @@ -51,7 +51,7 @@ sub new { $options{options}->add_options(arguments => { "hostname:s" => { name => 'hostname' }, - "port:s" => { name => 'port', default => '80' }, + "port:s" => { name => 'port', }, "proto:s" => { name => 'proto', default => "http" }, "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, diff --git a/apps/apache/serverstatus/mode/workers.pm b/apps/apache/serverstatus/mode/workers.pm index 657e885cc..b99f2a0a5 100644 --- a/apps/apache/serverstatus/mode/workers.pm +++ b/apps/apache/serverstatus/mode/workers.pm @@ -51,7 +51,7 @@ sub new { $options{options}->add_options(arguments => { "hostname:s" => { name => 'hostname' }, - "port:s" => { name => 'port', default => '80' }, + "port:s" => { name => 'port', }, "proto:s" => { name => 'proto', default => "http" }, "urlpath:s" => { name => 'url_path', default => "/server-status/?auto" }, "credentials" => { name => 'credentials' }, diff --git a/centreon/plugins/httplib.pm b/centreon/plugins/httplib.pm index 3c812f793..7ca20c856 100644 --- a/centreon/plugins/httplib.pm +++ b/centreon/plugins/httplib.pm @@ -46,8 +46,13 @@ sub connect { my $connection_exit = defined($options{connection_exit}) ? $options{connection_exit} : 'unknown'; my ($response, $content); + my $req; - my $req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname}.':'. $self->{option_results}->{port} . $self->{option_results}->{url_path}); + if (defined($self->{option_results}->{port})) { + $req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname}.':'. $self->{option_results}->{port} . $self->{option_results}->{url_path}); + } else { + $req = HTTP::Request->new( GET => $self->{option_results}->{proto}. "://" . $self->{option_results}->{hostname} . $self->{option_results}->{url_path}); + } if (defined($self->{option_results}->{credentials})) { $req->authorization_basic($self->{option_results}->{username}, $self->{option_results}->{password});