mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-25 22:55:15 +02:00
enh velocloud
This commit is contained in:
parent
4aae329d78
commit
2ea2d6e59e
@ -124,6 +124,9 @@ sub build_options_for_httplib {
|
|||||||
$self->{option_results}->{timeout} = $self->{timeout};
|
$self->{option_results}->{timeout} = $self->{timeout};
|
||||||
$self->{option_results}->{port} = $self->{port};
|
$self->{option_results}->{port} = $self->{port};
|
||||||
$self->{option_results}->{proto} = $self->{proto};
|
$self->{option_results}->{proto} = $self->{proto};
|
||||||
|
$self->{option_results}->{unknown_status} = '';
|
||||||
|
$self->{option_results}->{warning_status} = '';
|
||||||
|
$self->{option_results}->{critical_status} = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
sub settings {
|
sub settings {
|
||||||
|
@ -167,6 +167,11 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
foreach (keys %{$self->{edges}}) {
|
||||||
|
last if (defined($self->{edges}->{$_}->{apps}));
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No applications found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -167,6 +167,11 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
foreach (keys %{$self->{edges}}) {
|
||||||
|
last if (defined($self->{edges}->{$_}->{categories}));
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No category found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -196,6 +196,11 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
foreach (keys %{$self->{edges}}) {
|
||||||
|
last if (defined($self->{edges}->{$_}->{links}));
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No link found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -43,7 +43,7 @@ sub custom_status_calc {
|
|||||||
$self->{result_values}->{service_state} = $options{new_datas}->{$self->{instance} . '_service_state'};
|
$self->{result_values}->{service_state} = $options{new_datas}->{$self->{instance} . '_service_state'};
|
||||||
$self->{result_values}->{ha_state} = $options{new_datas}->{$self->{instance} . '_ha_state'};
|
$self->{result_values}->{ha_state} = $options{new_datas}->{$self->{instance} . '_ha_state'};
|
||||||
$self->{result_values}->{activation_state} = $options{new_datas}->{$self->{instance} . '_activation_state'};
|
$self->{result_values}->{activation_state} = $options{new_datas}->{$self->{instance} . '_activation_state'};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{edges} = [
|
$self->{maps_counters}->{edges} = [
|
||||||
{ label => 'status', set => {
|
{ label => 'status', threshold => 0, set => {
|
||||||
key_values => [ { name => 'edge_state' }, { name => 'service_state' }, { name => 'ha_state' },
|
key_values => [ { name => 'edge_state' }, { name => 'service_state' }, { name => 'ha_state' },
|
||||||
{ name => 'activation_state' }, { name => 'display' } ],
|
{ name => 'activation_state' }, { name => 'display' } ],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
@ -80,9 +80,10 @@ sub new {
|
|||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
|
|
||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"filter-name:s" => { name => 'filter_name' },
|
'filter-name:s' => { name => 'filter_name' },
|
||||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
'unknown-status:s' => { name => 'unknown_status', default => '%{edge_state} =~ /NEVER_ACTIVATED/' },
|
||||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
'warning-status:s' => { name => 'warning_status', default => '' },
|
||||||
|
'critical-status:s' => { name => 'critical_status', default => '%{edge_state} !~ /CONNECTED/ && %{edge_state} !~ /NEVER_ACTIVATED/' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -92,7 +93,7 @@ sub check_options {
|
|||||||
my ($self, %options) = @_;
|
my ($self, %options) = @_;
|
||||||
$self->SUPER::check_options(%options);
|
$self->SUPER::check_options(%options);
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
$self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
@ -138,6 +139,12 @@ Check edge status.
|
|||||||
|
|
||||||
Filter edge by name (Can be a regexp).
|
Filter edge by name (Can be a regexp).
|
||||||
|
|
||||||
|
=item B<--unknown-status>
|
||||||
|
|
||||||
|
Set unknown threshold for status (Default: '%{edge_state} =~ /NEVER_ACTIVATED/').
|
||||||
|
Can used special variables like: %{edge_state}, %{service_state},
|
||||||
|
%{ha_state}, %{activation_state}.
|
||||||
|
|
||||||
=item B<--warning-status>
|
=item B<--warning-status>
|
||||||
|
|
||||||
Set warning threshold for status (Default: '').
|
Set warning threshold for status (Default: '').
|
||||||
@ -146,7 +153,7 @@ Can used special variables like: %{edge_state}, %{service_state},
|
|||||||
|
|
||||||
=item B<--critical-status>
|
=item B<--critical-status>
|
||||||
|
|
||||||
Set critical threshold for status (Default: '').
|
Set critical threshold for status (Default: '%{edge_state} !~ /CONNECTED/ && %{edge_state} !~ /NEVER_ACTIVATED/').
|
||||||
Can used special variables like: %{edge_state}, %{service_state},
|
Can used special variables like: %{edge_state}, %{service_state},
|
||||||
%{ha_state}, %{activation_state}.
|
%{ha_state}, %{activation_state}.
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ sub set_counters {
|
|||||||
];
|
];
|
||||||
|
|
||||||
$self->{maps_counters}->{links} = [
|
$self->{maps_counters}->{links} = [
|
||||||
{ label => 'status', set => {
|
{ label => 'status', threshold => 0, set => {
|
||||||
key_values => [ { name => 'state' }, { name => 'vpn_state' },
|
key_values => [ { name => 'state' }, { name => 'vpn_state' },
|
||||||
{ name => 'display' }, { name => 'id' } ],
|
{ name => 'display' }, { name => 'id' } ],
|
||||||
closure_custom_calc => $self->can('custom_status_calc'),
|
closure_custom_calc => $self->can('custom_status_calc'),
|
||||||
@ -95,8 +95,9 @@ sub new {
|
|||||||
$options{options}->add_options(arguments => {
|
$options{options}->add_options(arguments => {
|
||||||
"filter-edge-name:s" => { name => 'filter_edge_name' },
|
"filter-edge-name:s" => { name => 'filter_edge_name' },
|
||||||
"filter-link-name:s" => { name => 'filter_link_name' },
|
"filter-link-name:s" => { name => 'filter_link_name' },
|
||||||
|
"unknown-status:s" => { name => 'unknown_status', default => '' },
|
||||||
"warning-status:s" => { name => 'warning_status', default => '' },
|
"warning-status:s" => { name => 'warning_status', default => '' },
|
||||||
"critical-status:s" => { name => 'critical_status', default => '' },
|
"critical-status:s" => { name => 'critical_status', default => '%{state} !~ /STABLE/ || %{vpn_state} !~ /STABLE/' },
|
||||||
});
|
});
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
@ -108,7 +109,7 @@ sub check_options {
|
|||||||
|
|
||||||
$self->{timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
$self->{timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 900;
|
||||||
|
|
||||||
$self->change_macros(macros => ['warning_status', 'critical_status']);
|
$self->change_macros(macros => ['unknown_status', 'warning_status', 'critical_status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub manage_selection {
|
sub manage_selection {
|
||||||
@ -153,6 +154,11 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
foreach (keys %{$self->{edges}}) {
|
||||||
|
last if (defined($self->{edges}->{$_}->{links}));
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No link found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
@ -173,6 +179,11 @@ Filter edge by name (Can be a regexp).
|
|||||||
|
|
||||||
Filter link by name (Can be a regexp).
|
Filter link by name (Can be a regexp).
|
||||||
|
|
||||||
|
=item B<--unknown-status>
|
||||||
|
|
||||||
|
Set unknown threshold for status (Default: '').
|
||||||
|
Can used special variables like: %{state}, %{vpn_state}.
|
||||||
|
|
||||||
=item B<--warning-status>
|
=item B<--warning-status>
|
||||||
|
|
||||||
Set warning threshold for status (Default: '').
|
Set warning threshold for status (Default: '').
|
||||||
@ -180,7 +191,7 @@ Can used special variables like: %{state}, %{vpn_state}.
|
|||||||
|
|
||||||
=item B<--critical-status>
|
=item B<--critical-status>
|
||||||
|
|
||||||
Set critical threshold for status (Default: '').
|
Set critical threshold for status (Default: '%{state} !~ /STABLE/ || %{vpn_state} !~ /STABLE/').
|
||||||
Can used special variables like: %{state}, %{vpn_state}.
|
Can used special variables like: %{state}, %{vpn_state}.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
@ -204,6 +204,11 @@ sub manage_selection {
|
|||||||
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
$self->{output}->add_option_msg(short_msg => "No edge found.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
foreach (keys %{$self->{edges}}) {
|
||||||
|
last if (defined($self->{edges}->{$_}->{links}));
|
||||||
|
$self->{output}->add_option_msg(short_msg => "No link found.");
|
||||||
|
$self->{output}->option_exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user