parent
a475404d1f
commit
e517dcf733
|
@ -108,13 +108,6 @@ sub check_options {
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$self->{cache_port} = '';
|
|
||||||
if (defined($self->{option_results}->{port}) && $self->{option_results}->{port} ne '') {
|
|
||||||
$self->{cache_port} = $self->{option_results}->{port};
|
|
||||||
} else {
|
|
||||||
$self->{cache_port} = 80 if ($self->{option_results}->{proto} eq 'http');
|
|
||||||
$self->{cache_port} = 443 if ($self->{option_results}->{proto} eq 'https');
|
|
||||||
}
|
|
||||||
$self->{statefile_value}->check_options(%options);
|
$self->{statefile_value}->check_options(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +130,7 @@ sub run {
|
||||||
}
|
}
|
||||||
$rPerSec = '0' . $rPerSec if ($rPerSec =~ /^\./);
|
$rPerSec = '0' . $rPerSec if ($rPerSec =~ /^\./);
|
||||||
|
|
||||||
$self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . $self->{cache_port} . '_' . $self->{mode});
|
$self->{statefile_value}->read(statefile => 'apache_' . $self->{option_results}->{hostname} . '_' . centreon::plugins::httplib::get_port($self) . '_' . $self->{mode});
|
||||||
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
|
my $old_timestamp = $self->{statefile_value}->get(name => 'last_timestamp');
|
||||||
my $old_total_access = $self->{statefile_value}->get(name => 'total_access');
|
my $old_total_access = $self->{statefile_value}->get(name => 'total_access');
|
||||||
my $old_total_bytes = $self->{statefile_value}->get(name => 'total_bytes');
|
my $old_total_bytes = $self->{statefile_value}->get(name => 'total_bytes');
|
||||||
|
|
|
@ -40,6 +40,20 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use LWP::UserAgent;
|
use LWP::UserAgent;
|
||||||
|
|
||||||
|
sub get_port {
|
||||||
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
|
my $cache_port = '';
|
||||||
|
if (defined($self->{option_results}->{port}) && $self->{option_results}->{port} ne '') {
|
||||||
|
$cache_port = $self->{option_results}->{port};
|
||||||
|
} else {
|
||||||
|
$cache_port = 80 if ($self->{option_results}->{proto} eq 'http');
|
||||||
|
$cache_port = 443 if ($self->{option_results}->{proto} eq 'https');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $cache_port;
|
||||||
|
}
|
||||||
|
|
||||||
sub connect {
|
sub connect {
|
||||||
my ($self, %options) = @_;
|
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});
|
||||||
|
|
Loading…
Reference in New Issue