mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 16:45:04 +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}}) {
|
||||
$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 {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->call_datas(cache => 1);
|
||||
$self->call_datas(cache => 1, addDeviceClient => $options{add_clients} // 0);
|
||||
$self->write_cache_file();
|
||||
|
||||
return $self->{datas};
|
||||
|
@ -30,7 +30,9 @@ sub new {
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options);
|
||||
bless $self, $class;
|
||||
|
||||
$options{options}->add_options(arguments => {});
|
||||
$options{options}->add_options(arguments => {
|
||||
'add-clients' => { name => 'add_clients' },
|
||||
});
|
||||
|
||||
return $self;
|
||||
}
|
||||
@ -38,7 +40,7 @@ sub new {
|
||||
sub manage_selection {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$options{custom}->cache_datas();
|
||||
$options{custom}->cache_datas(add_clients => $self->{option_results}->{add_clients} // 0);
|
||||
$self->{output}->output_add(
|
||||
severity => 'OK',
|
||||
short_msg => 'Cache files created successfully'
|
||||
|
@ -342,9 +342,15 @@ sub add_connection_stats {
|
||||
sub add_clients {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
my $clients = $options{custom}->get_device_clients(
|
||||
serial => $options{serial}
|
||||
);
|
||||
my $clients;
|
||||
if (defined($options{cache_datas})) {
|
||||
$clients = $options{cache_datas}->{ $options{serial} };
|
||||
|
||||
} else {
|
||||
$clients = $options{custom}->get_device_clients(
|
||||
serial => $options{serial}
|
||||
);
|
||||
}
|
||||
|
||||
$self->{devices}->{ $options{serial} }->{device_traffic} = {
|
||||
display => $options{name},
|
||||
@ -526,9 +532,10 @@ sub manage_selection {
|
||||
}
|
||||
if (!defined($self->{option_results}->{skip_clients}) && $datas->{devices}->{$serial}->{model} =~ /^(?:MS|MG|MR|MX)/) {
|
||||
$self->add_clients(
|
||||
custom => $options{custom},
|
||||
serial => $serial,
|
||||
name => $datas->{devices}->{$serial}->{name}
|
||||
custom => $options{custom},
|
||||
serial => $serial,
|
||||
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)/) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user