From 823178f284ddbf8e354236a8384226621ced20e7 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Tue, 28 Jul 2015 18:34:57 +0200 Subject: [PATCH] + Fix get_port http call (Ref #108) --- apps/apache/serverstatus/mode/requests.pm | 2 +- apps/apc/web/mode/filecache.pm | 2 +- apps/bluemind/mode/incoming.pm | 2 +- apps/github/mode/commits.pm | 2 +- apps/nginx/serverstatus/mode/requests.pm | 2 +- apps/protocols/tcp/mode/responsetime.pm | 4 ---- apps/protocols/udp/mode/connection.pm | 4 ---- apps/tomcat/web/mode/requestinfo.pm | 2 +- apps/tomcat/web/mode/traffic.pm | 2 +- 9 files changed, 7 insertions(+), 15 deletions(-) diff --git a/apps/apache/serverstatus/mode/requests.pm b/apps/apache/serverstatus/mode/requests.pm index 9ee9b4ffc..b167b4d30 100644 --- a/apps/apache/serverstatus/mode/requests.pm +++ b/apps/apache/serverstatus/mode/requests.pm @@ -115,7 +115,7 @@ sub run { $avg_bPerSec = '0' . $avg_bPerSec if ($avg_bPerSec =~ /^\./); $bPerReq = '0' . $bPerReq if ($bPerReq =~ /^\./); - $self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode}); + $self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode}); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); my $old_total_access = $self->{statefile_value}->get(name => 'total_access'); my $old_total_bytes = $self->{statefile_value}->get(name => 'total_bytes'); diff --git a/apps/apc/web/mode/filecache.pm b/apps/apc/web/mode/filecache.pm index a8b1ce895..ddefdbf8d 100644 --- a/apps/apc/web/mode/filecache.pm +++ b/apps/apc/web/mode/filecache.pm @@ -262,7 +262,7 @@ sub run { $self->manage_selection(); $self->{new_datas} = {}; - $self->{statefile_value}->read(statefile => "apc_" . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode}); + $self->{statefile_value}->read(statefile => "apc_" . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode}); $self->{new_datas}->{last_timestamp} = time(); my ($short_msg, $short_msg_append, $long_msg, $long_msg_append) = ('', '', '', ''); diff --git a/apps/bluemind/mode/incoming.pm b/apps/bluemind/mode/incoming.pm index ccf120f12..3e2c4de35 100644 --- a/apps/bluemind/mode/incoming.pm +++ b/apps/bluemind/mode/incoming.pm @@ -86,7 +86,7 @@ sub check_options { sub run { my ($self, %options) = @_; - $self->{statefile_value}->read(statefile => 'bluemind_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode}); + $self->{statefile_value}->read(statefile => 'bluemind_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode}); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); my $new_datas = {}; diff --git a/apps/github/mode/commits.pm b/apps/github/mode/commits.pm index 5f2db21d1..015db74ba 100644 --- a/apps/github/mode/commits.pm +++ b/apps/github/mode/commits.pm @@ -75,7 +75,7 @@ sub check_options { sub run { my ($self, %options) = @_; - $self->{statefile_value}->read(statefile => 'github_' . $self->{option_results}->{repository} . '_' . $self->{option_results}->{owner} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode}); + $self->{statefile_value}->read(statefile => 'github_' . $self->{option_results}->{repository} . '_' . $self->{option_results}->{owner} . '_' . $self->{http}->get_port() . '_' . $self->{mode}); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); my $new_datas = {}; diff --git a/apps/nginx/serverstatus/mode/requests.pm b/apps/nginx/serverstatus/mode/requests.pm index f79e37342..790cb1705 100644 --- a/apps/nginx/serverstatus/mode/requests.pm +++ b/apps/nginx/serverstatus/mode/requests.pm @@ -89,7 +89,7 @@ sub run { my $new_datas = {}; my $old_datas = {}; - $self->{statefile_value}->read(statefile => 'nginx_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode}); + $self->{statefile_value}->read(statefile => 'nginx_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode}); $old_datas->{timestamp} = $self->{statefile_value}->get(name => 'timestamp'); $new_datas->{timestamp} = time(); foreach (@{$maps}) { diff --git a/apps/protocols/tcp/mode/responsetime.pm b/apps/protocols/tcp/mode/responsetime.pm index 304d5e7e4..e4194dde5 100644 --- a/apps/protocols/tcp/mode/responsetime.pm +++ b/apps/protocols/tcp/mode/responsetime.pm @@ -69,10 +69,6 @@ sub check_options { sub run { my ($self, %options) = @_; - - if (!defined($self->{option_results}->{port})) { - $self->{option_results}->{port} = centreon::plugins::httplib::get_port($self); - } my ($connection, $timing0, $timeelapsed); if (defined($self->{option_results}->{ssl})) { diff --git a/apps/protocols/udp/mode/connection.pm b/apps/protocols/udp/mode/connection.pm index f96dc1733..2228a8243 100644 --- a/apps/protocols/udp/mode/connection.pm +++ b/apps/protocols/udp/mode/connection.pm @@ -67,10 +67,6 @@ sub check_options { sub run { my ($self, %options) = @_; - if (!defined($self->{option_results}->{port})) { - $self->{option_results}->{port} = centreon::plugins::httplib::get_port($self); - } - my $icmp_sock = new IO::Socket::INET(Proto=>"icmp"); my $read_set = new IO::Select(); $read_set->add($icmp_sock); diff --git a/apps/tomcat/web/mode/requestinfo.pm b/apps/tomcat/web/mode/requestinfo.pm index 38d04978d..9deffbcf4 100644 --- a/apps/tomcat/web/mode/requestinfo.pm +++ b/apps/tomcat/web/mode/requestinfo.pm @@ -213,7 +213,7 @@ sub run { $self->manage_selection(); my $new_datas = {}; - $self->{statefile_value}->read(statefile => 'cache_apps_tomcat_web_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{name}) ? md5_hex($self->{option_results}->{name}) : md5_hex('all'))); + $self->{statefile_value}->read(statefile => 'cache_apps_tomcat_web_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{name}) ? md5_hex($self->{option_results}->{name}) : md5_hex('all'))); $new_datas->{last_timestamp} = time(); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp'); diff --git a/apps/tomcat/web/mode/traffic.pm b/apps/tomcat/web/mode/traffic.pm index a77e0e4dc..219286a7a 100644 --- a/apps/tomcat/web/mode/traffic.pm +++ b/apps/tomcat/web/mode/traffic.pm @@ -198,7 +198,7 @@ sub run { $self->manage_selection(); my $new_datas = {}; - $self->{statefile_value}->read(statefile => 'cache_apps_tomcat_web_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{name}) ? md5_hex($self->{option_results}->{name}) : md5_hex('all'))); + $self->{statefile_value}->read(statefile => 'cache_apps_tomcat_web_' . $self->{option_results}->{hostname} . '_' . $self->{http}->get_port() . '_' . $self->{mode} . '_' . (defined($self->{option_results}->{name}) ? md5_hex($self->{option_results}->{name}) : md5_hex('all'))); $new_datas->{last_timestamp} = time(); my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');