From ef68077a2190e2feeb9e698e98ea4693d8f38d20 Mon Sep 17 00:00:00 2001 From: itoussies Date: Tue, 24 Dec 2024 10:00:09 +0100 Subject: [PATCH] Fix wrong variable assignment --- .../azure/network/vpngateway/mode/health.pm | 14 ++++++------- .../network/vpngateway/mode/sitetraffic.pm | 21 ++++++------------- .../network/vpngateway/mode/tunneltraffic.pm | 12 ++++------- .../vpngateway/mode/vpngatewaystatus.pm | 9 ++++---- ...{vpngateway.json => vpngatewaystatus.json} | 0 .../network/vpngateway/vpngatewaystatus.robot | 4 +++- 6 files changed, 24 insertions(+), 36 deletions(-) rename tests/cloud/azure/network/vpngateway/{vpngateway.json => vpngatewaystatus.json} (100%) diff --git a/src/cloud/azure/network/vpngateway/mode/health.pm b/src/cloud/azure/network/vpngateway/mode/health.pm index afb55d67b4..a2dbed8ebc 100644 --- a/src/cloud/azure/network/vpngateway/mode/health.pm +++ b/src/cloud/azure/network/vpngateway/mode/health.pm @@ -56,22 +56,22 @@ Set resource group (required if resource's name is used). =item B<--warning-status> Define the conditions to match for the status to be WARNING (default: ''). -You can use the following variables: %{status}, %{summary} +You can use the following variables: C<%{status}>, C<%{summary}>. =item B<--critical-status> -Define the conditions to match for the status to be CRITICAL (default: '%{status} =~ /^Unavailable$/'). -You can use the following variables: %{status}, %{summary} +Define the conditions to match for the status to be CRITICAL (default: C<%{status} =~ /^Unavailable$/>). +You can use the following variables: C<%{status}>, C<%{summary}>. =item B<--unknown-status> -Define the conditions to match for the status to be UNKNOWN (default: '%{status} =~ /^Unknown$/'). -You can use the following variables: %{status}, %{summary} +Define the conditions to match for the status to be UNKNOWN (default: C<%{status} =~ /^Unknown$/>). +You can use the following variables: C<%{status}>, C<%{summary}>. =item B<--ok-status> -Define the conditions to match for the status to be OK (default: '%{status} =~ /^Available$/'). -You can use the following variables: %{status}, %{summary} +Define the conditions to match for the status to be OK (default: C<%{status} =~ /^Available$/>). +You can use the following variables: C<%{status}>, C<%{summary}>. =back diff --git a/src/cloud/azure/network/vpngateway/mode/sitetraffic.pm b/src/cloud/azure/network/vpngateway/mode/sitetraffic.pm index 1cac9a61d0..21dba7d400 100644 --- a/src/cloud/azure/network/vpngateway/mode/sitetraffic.pm +++ b/src/cloud/azure/network/vpngateway/mode/sitetraffic.pm @@ -129,15 +129,11 @@ Example: Using resource name: -perl centreon_plugins.pl --plugin=cloud::azure::network::vpngateway::plugin --custommode=azcli --mode=site-traffic ---resource=MyResource --resource-group=MYRGROUP --aggregation='average' --aggregation='total' --critical-bandwidth-average='10' ---verbose +C Using resource ID: -perl centreon_plugins.pl --plugin=cloud::azure::network::vpngateway::plugin --custommode=azcli --mode=site-traffic ---resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Network/virtualNetworkGateways/xxx' ---aggregation='average' --aggregation='total' --critical-bandwidth-average='10' --verbose +C Default aggregation: 'average' (*Bandwidth), 'total' (P2SConnectionCount) @@ -153,18 +149,13 @@ Set resource group (required if resource's name is used). =item B<--filter-metric> -Filter metrics (can be: 'AverageBandwidth', 'P2SBandwidth', 'P2SConnectionCount') +Filter metrics (can be: C, C, C) (can be a regexp). -=item B<--warning-$label$> +=item B<--warning-$label$ --critical-$label$> -Warning thresholds -($label$ can be: 'bandwidth-average', 'p2s-bandwidth', p2s-connections) - -=item B<--critical-$label$> - -Critical thresholds -($label$ can be: 'bandwidth-average', 'p2s-bandwidth', p2s-connections) +Thresholds +($label$ can be: C, C, C) =back diff --git a/src/cloud/azure/network/vpngateway/mode/tunneltraffic.pm b/src/cloud/azure/network/vpngateway/mode/tunneltraffic.pm index aa1a357541..4bbe57381f 100644 --- a/src/cloud/azure/network/vpngateway/mode/tunneltraffic.pm +++ b/src/cloud/azure/network/vpngateway/mode/tunneltraffic.pm @@ -1,3 +1,4 @@ + # # Copyright 2024 Centreon (http://www.centreon.com/) # @@ -175,15 +176,10 @@ Filter metrics (can be: 'TunnelIngressBytes', 'TunnelEgressBytes', 'TunnelIngres 'TunnelEgressPackets', 'TunnelIngressPacketDropTSMismatch', 'TunnelEgressPacketDropTSMismatch') (can be a regexp). -=item B<--warning-$label$> - -Warning thresholds. -($label$ can be traffic-in, traffic-out, packets-in, packets-out, dropped-packets-in, dropped-packets-out) - -=item B<--critical-$label$> +=item B<--warning-$label$ --critical-$label$> -Critical thresholds -($label$ can be traffic-in, traffic-out, packets-in, packets-out, dropped-packets-in, dropped-packets-out) +Thresholds +($label$ can be C, C, C, C, C, C) =item B<--per-sec> diff --git a/src/cloud/azure/network/vpngateway/mode/vpngatewaystatus.pm b/src/cloud/azure/network/vpngateway/mode/vpngatewaystatus.pm index 9fa0fa2118..b2093655cd 100644 --- a/src/cloud/azure/network/vpngateway/mode/vpngatewaystatus.pm +++ b/src/cloud/azure/network/vpngateway/mode/vpngatewaystatus.pm @@ -120,8 +120,7 @@ __END__ Check VPN gateways status. Example: -perl centreon_plugins.pl --plugin=cloud::azure::network::vpngateway::plugin --custommode=azcli --mode=vpn-gateways-status ---resource-group='MYRESOURCEGROUP' --verbose +C =over 8 @@ -136,12 +135,12 @@ Filter VPN Gateways by name (can be a regexp). =item B<--warning-status> Define the conditions to match for the status to be WARNING (default: ''). -You can use the following variables: %{provisioning_state}, %{gateway_type}, %{vpn_type}, %{display} +You can use the following variables: C<%{provisioning_state}>, C<%{gateway_type}>, C<%{vpn_type}>, C<%{display}> =item B<--critical-status> -Define the conditions to match for the status to be CRITICAL (default: '%{provisioning_state} ne "Succeeded"'). -You can use the following variables: %{provisioning_state}, %{gateway_type}, %{vpn_type}, %{display} +Define the conditions to match for the status to be CRITICAL (default: C<%{provisioning_state} ne "Succeeded">). +You can use the following variables: C<%{provisioning_state}>, C<%{gateway_type}>, C<%{vpn_type}>, C<%{display>} =back diff --git a/tests/cloud/azure/network/vpngateway/vpngateway.json b/tests/cloud/azure/network/vpngateway/vpngatewaystatus.json similarity index 100% rename from tests/cloud/azure/network/vpngateway/vpngateway.json rename to tests/cloud/azure/network/vpngateway/vpngatewaystatus.json diff --git a/tests/cloud/azure/network/vpngateway/vpngatewaystatus.robot b/tests/cloud/azure/network/vpngateway/vpngatewaystatus.robot index c82b1f764f..9e9ae7494f 100644 --- a/tests/cloud/azure/network/vpngateway/vpngatewaystatus.robot +++ b/tests/cloud/azure/network/vpngateway/vpngatewaystatus.robot @@ -13,7 +13,7 @@ ${MOCKOON_JSON} ${CURDIR}${/}vpngatewaystatus.json ${BASE_URL} http://${HOSTNAME}:${APIPORT} ${LOGIN_ENDPOINT} ${BASE_URL}/login -${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::network::vpngateway::plugin --custommode=api --mode=vpn-gateway-status --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --resource-group=resource-group --login-endpoint=${LOGIN_ENDPOINT} --management-endpoint=${BASE_URL} +${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::network::vpngateway::plugin --custommode=api --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --resource-group=resource-group --login-endpoint=${LOGIN_ENDPOINT} *** Test Cases *** @@ -21,6 +21,8 @@ VPN Gateway status ${tc} [Tags] cloud azure api mockoon ${command} Catenate ... ${CMD} + ... --mode=vpn-gateway-status + ... --management-endpoint=${BASE_URL} ... ${extra_options} Ctn Run Command And Check Result As Strings ${command} ${expected_result}