mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 23:54:18 +02:00
(plugin) cloud::vmware::velocloud::restapi - fix empty return (#4476)
This commit is contained in:
parent
cde60ceeb1
commit
17979bb7c0
@ -25,6 +25,24 @@ use base qw(centreon::plugins::templates::counter);
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_app_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Application '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
@ -86,24 +104,6 @@ sub set_counters {
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_app_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Application '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
@ -137,8 +137,12 @@ sub manage_selection {
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{edges}->{ $edge->{name} }->{id} = $edge->{id};
|
||||
$self->{edges}->{ $edge->{name} }->{display} = $edge->{name};
|
||||
$self->{edges}->{ $edge->{name} } = {
|
||||
id => $edge->{id},
|
||||
display => $edge->{name},
|
||||
global => { app_count => 0 },
|
||||
apps => {}
|
||||
};
|
||||
|
||||
my $apps = $options{custom}->get_apps_metrics(
|
||||
edge_id => $edge->{id},
|
||||
|
@ -25,6 +25,24 @@ use base qw(centreon::plugins::templates::counter);
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_category_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Category '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
@ -86,24 +104,6 @@ sub set_counters {
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_category_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Category '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
@ -137,8 +137,12 @@ sub manage_selection {
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{edges}->{$edge->{name}}->{id} = $edge->{id};
|
||||
$self->{edges}->{$edge->{name}}->{display} = $edge->{name};
|
||||
$self->{edges}->{ $edge->{name} } = {
|
||||
id => $edge->{id},
|
||||
display => $edge->{name},
|
||||
global => { category_count => 0 },
|
||||
categories => {}
|
||||
};
|
||||
|
||||
my $categories = $options{custom}->get_categories_metrics(
|
||||
edge_id => $edge->{id},
|
||||
@ -160,7 +164,7 @@ sub manage_selection {
|
||||
traffic_out => int($category->{bytesTx} * 8 / $self->{timeframe}),
|
||||
traffic_in => int($category->{bytesRx} * 8 / $self->{timeframe}),
|
||||
packets_out => $category->{packetsTx} / $self->{timeframe},
|
||||
packets_in => $category->{packetsRx} / $self->{timeframe},
|
||||
packets_in => $category->{packetsRx} / $self->{timeframe}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,24 @@ use base qw(centreon::plugins::templates::counter);
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_link_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Link '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub set_counters {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
@ -102,24 +120,6 @@ sub set_counters {
|
||||
];
|
||||
}
|
||||
|
||||
sub prefix_edge_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Edge '" . $options{instance_value}->{display} . "' ";
|
||||
}
|
||||
|
||||
sub prefix_link_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Link '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub long_output {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
return "Checking edge '" . $options{instance_value}->{display} . "' [Id: " . $options{instance_value}->{id} . "] ";
|
||||
}
|
||||
|
||||
sub new {
|
||||
my ($class, %options) = @_;
|
||||
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1);
|
||||
@ -146,15 +146,19 @@ sub manage_selection {
|
||||
my $results = $options{custom}->list_edges();
|
||||
|
||||
$self->{edges} = {};
|
||||
foreach my $edge (@{$results}) {
|
||||
foreach my $edge (@$results) {
|
||||
if (defined($self->{option_results}->{filter_edge_name}) && $self->{option_results}->{filter_edge_name} ne '' &&
|
||||
$edge->{name} !~ /$self->{option_results}->{filter_edge_name}/) {
|
||||
$self->{output}->output_add(long_msg => "skipping '" . $edge->{name} . "'.", debug => 1);
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{edges}->{$edge->{name}}->{id} = $edge->{id};
|
||||
$self->{edges}->{$edge->{name}}->{display} = $edge->{name};
|
||||
$self->{edges}->{ $edge->{name} } = {
|
||||
id => $edge->{id},
|
||||
display => $edge->{name},
|
||||
global => { link_count => 0 },
|
||||
links => {}
|
||||
};
|
||||
|
||||
my $links = $options{custom}->list_links(
|
||||
edge_id => $edge->{id},
|
||||
|
@ -129,8 +129,12 @@ sub manage_selection {
|
||||
next;
|
||||
}
|
||||
|
||||
$self->{edges}->{$edge->{name}}->{id} = $edge->{id};
|
||||
$self->{edges}->{$edge->{name}}->{display} = $edge->{name};
|
||||
$self->{edges}->{ $edge->{name} } = {
|
||||
id => $edge->{id},
|
||||
display => $edge->{name},
|
||||
global => { link_count => 0 },
|
||||
links => {}
|
||||
};
|
||||
|
||||
my $links = $options{custom}->get_links_metrics(
|
||||
edge_id => $edge->{id},
|
||||
|
@ -192,7 +192,7 @@ sub manage_selection {
|
||||
$self->{edges}->{ $edge->{name} } = {
|
||||
id => $edge->{id},
|
||||
display => $edge->{name},
|
||||
global => {},
|
||||
global => { link_count => 0, traffic_in => 0, traffic_out => 0 },
|
||||
links => {}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user