From 51c91d8d0ac38e98a4ff1d9c17a42ac95e25a177 Mon Sep 17 00:00:00 2001 From: Thibault S <48209914+thibaults-centreon@users.noreply.github.com> Date: Thu, 4 Feb 2021 10:40:32 +0100 Subject: [PATCH] fix(mode): Fix Velocloud modes when edge offline (#2532) --- .../restapi/mode/applicationusage.pm | 13 ++++++++++- .../velocloud/restapi/mode/categoryusage.pm | 13 ++++++++++- .../vmware/velocloud/restapi/mode/edgeqoe.pm | 13 +++++++++-- .../velocloud/restapi/mode/linkstatus.pm | 23 +++++++++++++------ .../velocloud/restapi/mode/linkusage.pm | 11 ++++++++- 5 files changed, 61 insertions(+), 12 deletions(-) diff --git a/cloud/vmware/velocloud/restapi/mode/applicationusage.pm b/cloud/vmware/velocloud/restapi/mode/applicationusage.pm index 7a82df82e..44b9ff3c7 100644 --- a/cloud/vmware/velocloud/restapi/mode/applicationusage.pm +++ b/cloud/vmware/velocloud/restapi/mode/applicationusage.pm @@ -32,12 +32,22 @@ sub set_counters { { name => 'edges', type => 3, cb_prefix_output => 'prefix_edge_output', cb_long_output => 'long_output', message_multiple => 'All edges applications usage are ok', indent_long_output => ' ', group => [ + { name => 'global', type => 0 }, { name => 'apps', display_long => 1, cb_prefix_output => 'prefix_app_output', message_multiple => 'All applications usage are ok', type => 1 } ] } ]; + $self->{maps_counters}->{global} = [ + { label => 'edge-applications-count', nlabel => 'edge.applications.total.count', set => { + key_values => [ { name => 'app_count' } ], + output_template => '%s application(s)', + perfdatas => [ { template => '%d', unit => '', min => 0, label_extra_instance => 1 } ] + } + } + ]; + $self->{maps_counters}->{apps} = [ { label => 'traffic-in', nlabel => 'application.traffic.in.bitspersecond', set => { key_values => [ { name => 'traffic_in' }, { name => 'display' }, { name => 'id' } ], @@ -148,6 +158,7 @@ sub manage_selection { next; } + $self->{edges}->{$edge->{name}}->{global}->{app_count}++; $self->{edges}->{$edge->{name}}->{apps}->{ $app_name } = { id => $app->{application}, display => $app_name, @@ -186,7 +197,7 @@ Filter application by name (Can be a regexp). =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'traffic-in', 'traffic-out', +Can be: 'edge-applications-count', 'traffic-in', 'traffic-out', 'packets-in', 'packets-out'. =back diff --git a/cloud/vmware/velocloud/restapi/mode/categoryusage.pm b/cloud/vmware/velocloud/restapi/mode/categoryusage.pm index 6f66efa3f..9a758b581 100644 --- a/cloud/vmware/velocloud/restapi/mode/categoryusage.pm +++ b/cloud/vmware/velocloud/restapi/mode/categoryusage.pm @@ -32,12 +32,22 @@ sub set_counters { { name => 'edges', type => 3, cb_prefix_output => 'prefix_edge_output', cb_long_output => 'long_output', message_multiple => 'All edges categories usage are ok', indent_long_output => ' ', group => [ + { name => 'global', type => 0 }, { name => 'categories', display_long => 1, cb_prefix_output => 'prefix_category_output', message_multiple => 'All categories usage are ok', type => 1 } ] } ]; + $self->{maps_counters}->{global} = [ + { label => 'edge-categories-count', nlabel => 'edge.categories.total.count', set => { + key_values => [ { name => 'category_count' } ], + output_template => '%s categorie(s)', + perfdatas => [ { template => '%d', unit => '', min => 0, label_extra_instance => 1 } ] + } + } + ]; + $self->{maps_counters}->{categories} = [ { label => 'traffic-in', nlabel => 'category.traffic.in.bitspersecond', set => { key_values => [ { name => 'traffic_in' }, { name => 'display' }, { name => 'id' } ], @@ -143,6 +153,7 @@ sub manage_selection { next; } + $self->{edges}->{$edge->{name}}->{global}->{category_count}++; $self->{edges}->{$edge->{name}}->{categories}->{$category->{name}} = { id => $category->{category}, display => $category->{name}, @@ -181,7 +192,7 @@ Filter category by name (Can be a regexp). =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'traffic-in', 'traffic-out', +Can be: 'edge-categories-count', 'traffic-in', 'traffic-out', 'packets-in', 'packets-out'. =back diff --git a/cloud/vmware/velocloud/restapi/mode/edgeqoe.pm b/cloud/vmware/velocloud/restapi/mode/edgeqoe.pm index b5da1a275..61e9976ee 100644 --- a/cloud/vmware/velocloud/restapi/mode/edgeqoe.pm +++ b/cloud/vmware/velocloud/restapi/mode/edgeqoe.pm @@ -63,6 +63,14 @@ sub set_counters { { template => '%s', min => 0, max => 10, label_extra_instance => 1 } ] } + }, + { label => 'edge-links-count', nlabel => 'global.links.total.count', set => { + key_values => [ { name => 'link_count' } ], + output_template => '%s link(s)', + perfdatas => [ + { template => '%d', unit => '', min => 0, label_extra_instance => 1 } + ] + } } ]; @@ -175,6 +183,7 @@ sub manage_selection { next; } + $self->{edges}->{$edge->{name}}->{global}->{link_count}++; $self->{edges}->{$edge->{name}}->{links}->{$link->{link}->{displayName}} = { id => $link->{linkId}, display => $link->{link}->{displayName}, @@ -212,9 +221,9 @@ Filter link by name (Can be a regexp). =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'qoe-voice-global', 'qoe-video-global', 'qoe-transactional-global' (global values) and/or +Can be: 'edge-links-count', 'qoe-voice-global', 'qoe-video-global', 'qoe-transactional-global' (global values) and/or 'qoe-voice', 'qoe-video', 'qoe-transactional' (per link values). =back -=cut +=cut \ No newline at end of file diff --git a/cloud/vmware/velocloud/restapi/mode/linkstatus.pm b/cloud/vmware/velocloud/restapi/mode/linkstatus.pm index e747c1b53..54c7f098a 100644 --- a/cloud/vmware/velocloud/restapi/mode/linkstatus.pm +++ b/cloud/vmware/velocloud/restapi/mode/linkstatus.pm @@ -44,12 +44,22 @@ sub set_counters { { name => 'edges', type => 3, cb_prefix_output => 'prefix_edge_output', cb_long_output => 'long_output', message_multiple => 'All edges links status are ok', indent_long_output => ' ', group => [ + { name => 'global', type => 0 }, { name => 'links', display_long => 1, cb_prefix_output => 'prefix_link_output', message_multiple => 'All links status are ok', type => 1 } ] } ]; + $self->{maps_counters}->{global} = [ + { label => 'edge-links-count', nlabel => 'edge.links.total.count', set => { + key_values => [ { name => 'link_count' } ], + output_template => '%s link(s)', + perfdatas => [ { template => '%d', unit => '', min => 0 } ] + } + } + ]; + $self->{maps_counters}->{links} = [ { label => 'status', @@ -134,6 +144,7 @@ sub manage_selection { next; } + $self->{edges}->{$edge->{name}}->{global}->{link_count}++; $self->{edges}->{$edge->{name}}->{links}->{$link->{link}->{displayName}} = { id => $link->{linkId}, display => $link->{link}->{displayName}, @@ -173,15 +184,13 @@ Filter link by name (Can be a regexp). Set unknown threshold for status (Default: ''). Can used special variables like: %{state}, %{vpn_state}, %{backup_state}. -=item B<--warning-status> +=item B<--warning-*> B<--critical-*> -Set warning threshold for status (Default: ''). -Can used special variables like: %{state}, %{vpn_state}, %{backup_state}. +Warning & Critical thresholds +Can be 'status', 'edge-links-count'. -=item B<--critical-status> - -Set critical threshold for status (Default: '%{state} !~ /STABLE/ || %{vpn_state} !~ /STABLE/'). -Can used special variables like: %{state}, %{vpn_state}, %{backup_state}. +For 'status', special variables can be used: %{state}, %{vpn_state}, %{backup_state} +(Critical threshold default: '%{state} !~ /STABLE/ || %{vpn_state} !~ /STABLE/'). =back diff --git a/cloud/vmware/velocloud/restapi/mode/linkusage.pm b/cloud/vmware/velocloud/restapi/mode/linkusage.pm index b8bc87b64..46bf3ee0a 100644 --- a/cloud/vmware/velocloud/restapi/mode/linkusage.pm +++ b/cloud/vmware/velocloud/restapi/mode/linkusage.pm @@ -57,6 +57,14 @@ sub set_counters { { template => '%s', min => 0, unit => 'b/s', label_extra_instance => 1 } ] } + }, + { label => 'edge-links-count', nlabel => 'links.total.count', set => { + key_values => [ { name => 'link_count' } ], + output_template => '%s link(s)', + perfdatas => [ + { template => '%d', unit => '', min => 0, label_extra_instance => 1 } + ] + } } ]; @@ -200,6 +208,7 @@ sub manage_selection { next; } + $self->{edges}->{$edge->{name}}->{global}->{link_count}++; $self->{edges}->{$edge->{name}}->{links}->{$link->{link}->{displayName}} = { id => $link->{linkId}, display => $link->{link}->{displayName}, @@ -248,7 +257,7 @@ Filter link by name (Can be a regexp). =item B<--warning-*> B<--critical-*> Thresholds. -Can be: 'links-traffic-in', 'links-traffic-out', +Can be: 'edge-links-count', 'links-traffic-in', 'links-traffic-out', 'traffic-in', 'traffic-out', 'latency-in', 'latency-out', 'jitter-in', 'jitter-out', 'packet-loss-in', 'packet-loss-out'.