mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-31 01:24:35 +02:00
wip
This commit is contained in:
parent
ea71dd261a
commit
35b8b67626
@ -284,13 +284,23 @@ sub call_datas {
|
|||||||
foreach my $orgId (keys %{$self->{datas}->{orgs}}) {
|
foreach my $orgId (keys %{$self->{datas}->{orgs}}) {
|
||||||
$self->get_organization_uplink_loss_and_latency(orgId => $orgId);
|
$self->get_organization_uplink_loss_and_latency(orgId => $orgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined($options{addDeviceClient}) && $options{addDeviceClient} == 1) {
|
||||||
|
$self->{datas}->{device_clients} = {};
|
||||||
|
foreach my $serial (keys %{$self->{datas}->{devices}}) {
|
||||||
|
$self->{datas}->{device_clients}->{$serial} = $self->get_device_clients(
|
||||||
|
serial => $serial
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub cache_datas {
|
sub cache_datas {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$self->call_datas(cache => 1);
|
$self->call_datas(cache => 1, addDeviceClient => $options{add_clients} // 0);
|
||||||
$self->write_cache_file();
|
$self->write_cache_file();
|
||||||
|
|
||||||
return $self->{datas};
|
return $self->{datas};
|
||||||
|
@ -30,7 +30,9 @@ sub new {
|
|||||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {});
|
$options{options}->add_options(arguments => {
|
||||||
|
'add-clients' => { name => 'add_clients' },
|
||||||
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ sub new {
|
|||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
$options{custom}->cache_datas();
|
$options{custom}->cache_datas(add_clients => $self->{option_results}->{add_clients} // 0);
|
||||||
$self->{output}->output_add(
|
$self->{output}->output_add(
|
||||||
severity => 'OK',
|
severity => 'OK',
|
||||||
short_msg => 'Cache files created successfully'
|
short_msg => 'Cache files created successfully'
|
||||||
|
@ -342,9 +342,15 @@ sub add_connection_stats {
|
|||||||
sub add_clients {
|
sub add_clients {
|
||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
|
|
||||||
my $clients = $options{custom}->get_device_clients(
|
my $clients;
|
||||||
|
if (defined($options{cache_datas})) {
|
||||||
|
$clients = $options{cache_datas}->{ $options{serial} };
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$clients = $options{custom}->get_device_clients(
|
||||||
serial => $options{serial}
|
serial => $options{serial}
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$self->{devices}->{ $options{serial} }->{device_traffic} = {
|
$self->{devices}->{ $options{serial} }->{device_traffic} = {
|
||||||
display => $options{name},
|
display => $options{name},
|
||||||
@ -528,7 +534,8 @@ sub manage_selection {
|
|||||||
$self->add_clients(
|
$self->add_clients(
|
||||||
custom => $options{custom},
|
custom => $options{custom},
|
||||||
serial => $serial,
|
serial => $serial,
|
||||||
name => $datas->{devices}->{$serial}->{name}
|
name => $datas->{devices}->{$serial}->{name},
|
||||||
|
cache_datas => (defined($self->{option_results}->{cache_use}) && defined($datas->{device_clients})) ? $datas->{device_clients} : undef
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($datas->{devices}->{$serial}->{model} =~ /^(?:MV|MS|MG|MR|MX)/) {
|
if ($datas->{devices}->{$serial}->{model} =~ /^(?:MV|MS|MG|MR|MX)/) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user