From 9cee92778fdfe4ff814c934b3382fa9e3371d4cb Mon Sep 17 00:00:00 2001 From: omercier <32134301+omercier@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:47:46 +0100 Subject: [PATCH] fix(azure-elasticpool): the thresholds weren't applied correctly in storage mode (#5294) Refs: CTOR-858 --- .../database/elasticpool/mode/storage.pm | 77 +++-- .../azure/database/elasticpool/mockoon.json | 270 ++++++++++++++++++ .../azure/database/elasticpool/storage.robot | 40 +++ 3 files changed, 361 insertions(+), 26 deletions(-) create mode 100644 tests/cloud/azure/database/elasticpool/mockoon.json create mode 100644 tests/cloud/azure/database/elasticpool/storage.robot diff --git a/src/cloud/azure/database/elasticpool/mode/storage.pm b/src/cloud/azure/database/elasticpool/mode/storage.pm index 8be2a73c7..dd150fbf8 100644 --- a/src/cloud/azure/database/elasticpool/mode/storage.pm +++ b/src/cloud/azure/database/elasticpool/mode/storage.pm @@ -56,8 +56,9 @@ sub custom_metric_calc { my ($self, %options) = @_; $self->{result_values}->{timeframe} = $options{new_datas}->{$self->{instance} . '_timeframe'}; - $self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}}; - $self->{result_values}->{metric} = $options{extra_options}->{metric}; + $self->{result_values}->{value} = $options{new_datas}->{$self->{instance} . '_' . $options{extra_options}->{metric}}; + $self->{result_values}->{metric} = $options{extra_options}->{metric}; + return 0; } @@ -67,8 +68,8 @@ sub custom_metric_threshold { my $exit = $self->{perfdata}->threshold_check( value => $self->{result_values}->{value}, threshold => [ - { label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label} , exit_litteral => 'critical' }, - { label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}, exit_litteral => 'warning' } + { label => 'critical-' . $self->{thlabel}, exit_litteral => 'critical' }, + { label => 'warning-' . $self->{thlabel}, exit_litteral => 'warning' } ] ); return $exit; @@ -82,8 +83,8 @@ sub custom_metric_perfdata { nlabel => $metrics_mapping{$self->{result_values}->{metric}}->{nlabel}, unit => $metrics_mapping{$self->{result_values}->{metric}}->{unit}, value => sprintf('%.2f', $self->{result_values}->{value}), - warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}), - critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $metrics_mapping{$self->{result_values}->{metric}}->{label}) + warning => $self->{perfdata}->get_perfdata_for_output(label => 'warning-' . $self->{thlabel}), + critical => $self->{perfdata}->get_perfdata_for_output(label => 'critical-' . $self->{thlabel}) ); } @@ -112,7 +113,7 @@ sub prefix_statistics_output { sub long_output { my ($self, %options) = @_; - return "Checking Pool'" . $options{instance_value}->{display} . "' "; + return "Checking Pool '" . $options{instance_value}->{display} . "' "; } sub set_counters { @@ -128,7 +129,7 @@ sub set_counters { } ]; - foreach my $metric (keys %metrics_mapping) { + foreach my $metric (sort keys %metrics_mapping) { my $entry = { label => $metrics_mapping{$metric}->{label}, nlabel => $metrics_mapping{$metric}->{nlabel}, @@ -186,8 +187,8 @@ sub check_options { } foreach my $metric (keys %metrics_mapping) { - next if (defined($self->{option_results}->{filter_metric}) && $self->{option_results}->{filter_metric} ne '' - && $metric !~ /$self->{option_results}->{filter_metric}/); + next if ( !centreon::plugins::misc::is_empty($self->{option_results}->{filter_metric}) + && $metric !~ /$self->{option_results}->{filter_metric}/ ); push @{$self->{az_metrics}}, $metric; } @@ -254,48 +255,72 @@ __END__ =head1 MODE -Check Azure SQL Elastic Pool Storage metrics. +Monitor Azure SQL Elastic Pool Storage metrics. Example: Using resource name: -perl centreon_plugins.pl --plugin=cloud::azure::database::elasticpool::plugin --custommode=azcli --mode=storage ---resource=/elasticpools/ --resource-group= --aggregation='average' ---allocated-data-storage-percent='90' --verbose + perl centreon_plugins.pl --plugin=cloud::azure::database::elasticpool::plugin --custommode=azcli --mode=storage + --resource=/elasticpools/ --resource-group= --aggregation='average' + --allocated-data-storage-percent='90' --verbose Using resource ID: -perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=sessions ---resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Sql/servers/xxx/elasticpools/xxx' ---aggregation='average' --allocated-data-storage-percent='90' --verbose + perl centreon_plugins.pl --plugin=cloud::azure::compute::virtualmachine::plugin --custommode=azcli --mode=sessions + --resource='/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.Sql/servers/xxx/elasticpools/xxx' + --aggregation='average' --allocated-data-storage-percent='90' --verbose -Default aggregation: 'average' / 'minimum' and 'maximum' are valid. +Available aggregations: 'average' (default) 'minimum' and 'maximum'. =over 8 =item B<--resource> -Set resource name or ID (required). +Define the resource name or ID (required). =item B<--resource-group> -Set resource group (required if resource's name is used). +Define the resource group to monitor (required if the resource name is used). =item B<--filter-metric> Filter on specific metrics. The Azure format must be used, for example: 'allocated_data_storage_percent' (can be a regexp). -=item B<--warning-*> +=item B<--warning-allocated-data-storage> -Warning threshold where * can be: 'allocated-data-storage', allocated-data-storage-percent', -'storage-percent', 'storage-used'. +Thresholds. -=item B<--critical-*> +=item B<--critical-allocated-data-storage> + +Thresholds. + +=item B<--warning-allocated-data-storage-percent> + +Thresholds. + +=item B<--critical-allocated-data-storage-percent> + +Thresholds. + + +=item B<--warning-storage-percent> + +Thresholds. + +=item B<--critical-storage-percent> + +Thresholds. + +=item B<--warning-storage-used> + +Thresholds. + +=item B<--critical-storage-used> + +Thresholds. -Critical threshold where * can be: 'allocated-data-storage', allocated-data-storage-percent', -'storage-percent', 'storage-used'. =back diff --git a/tests/cloud/azure/database/elasticpool/mockoon.json b/tests/cloud/azure/database/elasticpool/mockoon.json new file mode 100644 index 000000000..266fa9eb1 --- /dev/null +++ b/tests/cloud/azure/database/elasticpool/mockoon.json @@ -0,0 +1,270 @@ +{ + "uuid": "101906e9-f832-416c-8781-880c33a0a778", + "lastMigration": 33, + "name": "Azure Elasticpool", + "endpointPrefix": "", + "latency": 0, + "port": 3000, + "hostname": "", + "folders": [], + "routes": [ + { + "uuid": "433aa2a7-20df-4682-88ef-4c87bd0882e1", + "documentation": "Azure login", + "method": "post", + "endpoint": "login/:tenant/oauth2/token", + "responses": [ + { + "uuid": "0c775d57-8661-4c4f-9f30-a3a134d6d09c", + "body": "{\n \"access_token\": \"token\",\n \"expires_on\": \"{{ faker 'string.numeric' 10 }}\"\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "type": "http", + "streamingMode": null, + "streamingInterval": 0 + }, + { + "uuid": "3f190dd9-690a-413a-bafa-5c9d369b7d22", + "documentation": "", + "method": "post", + "endpoint": "ok/subscriptions/:subscriptionId/providers/Microsoft.PolicyInsights/policyStates/:policyStatesResource/queryResults", + "responses": [ + { + "uuid": "06ebc038-a4f5-48d5-8fb8-2403915a9754", + "body": "{\r\n \"@odata.nextLink\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest\",\r\n \"@odata.count\": 2,\r\n \"value\": [\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip1\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/Enable Monitoring in Azure Security Center\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"Enable Monitoring in Azure Security Center\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip2\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"mypubip3\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n }\r\n ]\r\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "type": "http", + "streamingMode": null, + "streamingInterval": 0 + }, + { + "uuid": "31c8940d-4623-444c-92e1-f340fe74b5b3", + "documentation": "", + "method": "post", + "endpoint": "nok1/subscriptions/:subscriptionId/providers/Microsoft.PolicyInsights/policyStates/:policyStatesResource/queryResults", + "responses": [ + { + "uuid": "64c245ca-0190-4b2e-89d5-87383148286c", + "body": "{\r\n \"@odata.nextLink\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest\",\r\n \"@odata.count\": 2,\r\n \"value\": [\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip1\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/Enable Monitoring in Azure Security Center\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": false,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"Enable Monitoring in Azure Security Center\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"NonCompliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip2\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n }\r\n ]\r\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "type": "http", + "streamingMode": null, + "streamingInterval": 0 + }, + { + "uuid": "13bf6e0e-8843-4681-942e-404b01326f32", + "documentation": "", + "method": "post", + "endpoint": "nok2/subscriptions/:subscriptionId/providers/Microsoft.PolicyInsights/policyStates/:policyStatesResource/queryResults", + "responses": [ + { + "uuid": "709a35af-cf2b-41f7-a224-3a946ffce703", + "body": "{\r\n \"@odata.nextLink\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest\",\r\n \"@odata.count\": 2,\r\n \"value\": [\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip1\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/Enable Monitoring in Azure Security Center\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": false,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"Enable Monitoring in Azure Security Center\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"NonCompliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip2\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": false,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"NonCompliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n }\r\n ]\r\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "type": "http", + "streamingMode": null, + "streamingInterval": 0 + }, + { + "uuid": "1eb461f8-c128-432b-a7ca-7ddd71c28fa4", + "documentation": "", + "method": "post", + "endpoint": "oknextlink/subscriptions/:subscriptionId/providers/Microsoft.PolicyInsights/policyStates/:policyStatesResource/queryResults", + "responses": [ + { + "uuid": "a0daaaa4-9c21-4d4d-aa0a-a99da2de7479", + "body": "{\r\n \"@odata.nextLink\": \"http://localhost:3000/ok/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/latest/queryResults\",\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest\",\r\n \"@odata.count\": 2,\r\n \"value\": [\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip1\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/Enable Monitoring in Azure Security Center\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"Enable Monitoring in Azure Security Center\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/resourceGroups/myrg1/providers/Microsoft.Network/publicIPAddresses/mypubip2\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n },\r\n {\r\n \"@odata.id\": null,\r\n \"@odata.context\": \"https://management.azure.com/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.PolicyInsights/policyStates/$metadata#latest/$entity\",\r\n \"timestamp\": \"2019-10-09T17:48:05Z\",\r\n \"resourceId\": \"mypubip3\",\r\n \"policyAssignmentId\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852/providers/Microsoft.Authorization/policyAssignments/9ac09b0657d942e5ad4041a6\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"effectiveParameters\": null,\r\n \"isCompliant\": true,\r\n \"subscriptionId\": \"fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"resourceType\": \"/Microsoft.Network/publicIPAddresses\",\r\n \"resourceLocation\": \"eastus\",\r\n \"resourceGroup\": \"myrg1\",\r\n \"resourceTags\": \"tbd\",\r\n \"policyAssignmentName\": \"9ac09b0657d942e5ad4041a6\",\r\n \"policyAssignmentOwner\": \"tbd\",\r\n \"policyAssignmentParameters\": \"{}\",\r\n \"policyAssignmentScope\": \"/subscriptions/fffedd8f-ffff-fffd-fffd-fffed2f84852\",\r\n \"policyDefinitionName\": \"9daedab3-fb2d-461e-b861-71790eead4f6\",\r\n \"policyDefinitionAction\": \"AuditIfNotExists\",\r\n \"policyDefinitionCategory\": \"tbd\",\r\n \"policySetDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionName\": \"1f3afdf9-d0c9-4c3d-847f-89da613e70a8\",\r\n \"policySetDefinitionOwner\": null,\r\n \"policySetDefinitionCategory\": null,\r\n \"policySetDefinitionParameters\": null,\r\n \"managementGroupIds\": \"mymg,fff988bf-fff1-ffff-fffb-fffcd011db47\",\r\n \"policyDefinitionReferenceId\": null,\r\n \"complianceState\": \"Compliant\",\r\n \"policyDefinitionGroupNames\": [\r\n \"myGroup\"\r\n ],\r\n \"policyDefinitionVersion\": \"1.0.0-preview\",\r\n \"policySetDefinitionVersion\": \"2.0.1\",\r\n \"policyAssignmentVersion\": \"1.0.0\"\r\n }\r\n ]\r\n}", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": true, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "type": "http", + "streamingMode": null, + "streamingInterval": 0 + }, + { + "uuid": "17207a2f-0876-4f3c-ac6a-4fc70288983b", + "type": "http", + "documentation": "", + "method": "get", + "endpoint": "subscriptions/subscription/resourceGroups/emsp-tf-prod-va-rg/providers/Microsoft.Sql/servers/sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do/providers/microsoft.insights/metrics", + "responses": [ + { + "uuid": "83989c8e-65f5-4688-914e-282ade263af7", + "body": "{\n \"cost\": 56,\n \"timespan\": \"2024-08-22T07:50:45Z/2024-08-22T08:05:45Z\",\n \"interval\": \"PT5M\",\n \"value\": [\n {\n \"id\": \"/subscriptions/c0502582-e12d-4e8d-a67b-55b5b08e3e68/resourceGroups/emsp-tf-prod-va-rg/providers/Microsoft.Sql/servers/sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do/providers/Microsoft.Insights/metrics/allocated_data_storage\",\n \"type\": \"Microsoft.Insights/metrics\",\n \"name\": {\n \"value\": \"allocated_data_storage\",\n \"localizedValue\": \"Data space allocated\"\n },\n \"displayDescription\": \"Data space allocated\",\n \"unit\": \"Bytes\",\n \"timeseries\": [\n {\n \"metadatavalues\": [],\n \"data\": [\n {\n \"timeStamp\": \"2024-08-22T07:50:00Z\",\n \"average\": 215822106624\n },\n {\n \"timeStamp\": \"2024-08-22T07:55:00Z\",\n \"average\": 215822106624\n },\n {\n \"timeStamp\": \"2024-08-22T08:00:00Z\",\n \"average\": 215822106624\n }\n ]\n }\n ],\n \"errorCode\": \"Success\"\n },\n {\n \"id\": \"/subscriptions/c0502582-e12d-4e8d-a67b-55b5b08e3e68/resourceGroups/emsp-tf-prod-va-rg/providers/Microsoft.Sql/servers/sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do/providers/Microsoft.Insights/metrics/storage_percent\",\n \"type\": \"Microsoft.Insights/metrics\",\n \"name\": {\n \"value\": \"storage_percent\",\n \"localizedValue\": \"Data space used percent\"\n },\n \"displayDescription\": \"Data space used percent. Not applicable to hyperscale\",\n \"unit\": \"Percent\",\n \"timeseries\": [\n {\n \"metadatavalues\": [],\n \"data\": [\n {\n \"timeStamp\": \"2024-08-22T07:50:00Z\",\n \"average\": 38\n },\n {\n \"timeStamp\": \"2024-08-22T07:55:00Z\",\n \"average\": 38\n },\n {\n \"timeStamp\": \"2024-08-22T08:00:00Z\",\n \"average\": 38\n }\n ]\n }\n ],\n \"errorCode\": \"Success\"\n },\n {\n \"id\": \"/subscriptions/c0502582-e12d-4e8d-a67b-55b5b08e3e68/resourceGroups/emsp-tf-prod-va-rg/providers/Microsoft.Sql/servers/sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do/providers/Microsoft.Insights/metrics/storage_used\",\n \"type\": \"Microsoft.Insights/metrics\",\n \"name\": {\n \"value\": \"storage_used\",\n \"localizedValue\": \"Data space used\"\n },\n \"displayDescription\": \"Data space used\",\n \"unit\": \"Bytes\",\n \"timeseries\": [\n {\n \"metadatavalues\": [],\n \"data\": [\n {\n \"timeStamp\": \"2024-08-22T07:50:00Z\",\n \"average\": 122406567936\n },\n {\n \"timeStamp\": \"2024-08-22T07:55:00Z\",\n \"average\": 122406567936\n },\n {\n \"timeStamp\": \"2024-08-22T08:00:00Z\",\n \"average\": 122406567936\n }\n ]\n }\n ],\n \"errorCode\": \"Success\"\n },\n {\n \"id\": \"/subscriptions/c0502582-e12d-4e8d-a67b-55b5b08e3e68/resourceGroups/emsp-tf-prod-va-rg/providers/Microsoft.Sql/servers/sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do/providers/Microsoft.Insights/metrics/allocated_data_storage_percent\",\n \"type\": \"Microsoft.Insights/metrics\",\n \"name\": {\n \"value\": \"allocated_data_storage_percent\",\n \"localizedValue\": \"Data space allocated percent\"\n },\n \"displayDescription\": \"Data space allocated percent. Not applicable to hyperscale\",\n \"unit\": \"Percent\",\n \"timeseries\": [\n {\n \"metadatavalues\": [],\n \"data\": [\n {\n \"timeStamp\": \"2024-08-22T07:50:00Z\",\n \"average\": 67\n },\n {\n \"timeStamp\": \"2024-08-22T07:55:00Z\",\n \"average\": 67\n },\n {\n \"timeStamp\": \"2024-08-22T08:00:00Z\",\n \"average\": 67\n }\n ]\n }\n ],\n \"errorCode\": \"Success\"\n }\n ],\n \"namespace\": \"Microsoft.Sql/servers/elasticpools\",\n \"resourceregion\": \"francecentral\"\n}\n", + "latency": 0, + "statusCode": 200, + "label": "", + "headers": [ + { + "key": "content-security-policy", + "value": "default-src 'none'" + }, + { + "key": "content-type", + "value": "text/html; charset=utf-8" + }, + { + "key": "x-content-type-options", + "value": "nosniff" + } + ], + "bodyType": "INLINE", + "filePath": "", + "databucketID": "", + "sendFileAsBody": false, + "rules": [], + "rulesOperator": "OR", + "disableTemplating": false, + "fallbackTo404": false, + "default": false, + "crudKey": "id", + "callbacks": [] + } + ], + "responseMode": null, + "streamingMode": null, + "streamingInterval": 0 + } + ], + "rootChildren": [ + { + "type": "route", + "uuid": "433aa2a7-20df-4682-88ef-4c87bd0882e1" + }, + { + "type": "route", + "uuid": "3f190dd9-690a-413a-bafa-5c9d369b7d22" + }, + { + "type": "route", + "uuid": "1eb461f8-c128-432b-a7ca-7ddd71c28fa4" + }, + { + "type": "route", + "uuid": "31c8940d-4623-444c-92e1-f340fe74b5b3" + }, + { + "type": "route", + "uuid": "13bf6e0e-8843-4681-942e-404b01326f32" + }, + { + "type": "route", + "uuid": "17207a2f-0876-4f3c-ac6a-4fc70288983b" + } + ], + "proxyMode": false, + "proxyHost": "", + "proxyRemovePrefix": false, + "tlsOptions": { + "enabled": false, + "type": "CERT", + "pfxPath": "", + "certPath": "", + "keyPath": "", + "caPath": "", + "passphrase": "" + }, + "cors": true, + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "proxyReqHeaders": [ + { + "key": "", + "value": "" + } + ], + "proxyResHeaders": [ + { + "key": "", + "value": "" + } + ], + "data": [], + "callbacks": [] +} \ No newline at end of file diff --git a/tests/cloud/azure/database/elasticpool/storage.robot b/tests/cloud/azure/database/elasticpool/storage.robot new file mode 100644 index 000000000..7566fbd4c --- /dev/null +++ b/tests/cloud/azure/database/elasticpool/storage.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Azure Database Elasticpool plugin + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource + +Suite Setup Start Mockoon ${MOCKOON_JSON} +Suite Teardown Stop Mockoon +Test Timeout 120s + + +*** Variables *** +${MOCKOON_JSON} ${CURDIR}${/}mockoon.json + +${BASE_URL} http://${HOSTNAME}:${APIPORT} +${LOGIN_ENDPOINT} ${BASE_URL}/login +${CMD} ${CENTREON_PLUGINS} --plugin=cloud::azure::database::elasticpool::plugin --custommode=api --mode=storage --subscription=subscription --tenant=tenant --client-id=client_id --client-secret=secret --login-endpoint=${LOGIN_ENDPOINT} --management-endpoint=${BASE_URL} + + +*** Test Cases *** +Storage ${tc} + [Tags] cloud azure api mockoon + ${command} Catenate + ... ${CMD} + ... --resource=${resource} + ... --resource-group=${resource_group} + ... ${thresholds} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc resource resource_group thresholds expected_result -- + ... 1 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg ${EMPTY} OK: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Allocated data storage: 201.00 GB, Allocated data storage percentage: 67.00 %, Storage usage percentage: 38.00 %, Storage usage: 114.00 GB | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 2 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --warning-allocated-data-storage-percent=0.01 WARNING: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Allocated data storage percentage: 67.00 % | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;0:0.01;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 3 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --critical-allocated-data-storage-percent=0.01 CRITICAL: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Allocated data storage percentage: 67.00 % | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;0:0.01;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 4 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --warning-allocated-data-storage=0.01 WARNING: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Allocated data storage: 201.00 GB | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;0:0.01;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 5 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --critical-allocated-data-storage=0.01 CRITICAL: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Allocated data storage: 201.00 GB | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;0:0.01;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 6 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --warning-storage-percent=0.01 WARNING: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Storage usage percentage: 38.00 % | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;0:0.01;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 7 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --critical-storage-percent=0.01 CRITICAL: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Storage usage percentage: 38.00 % | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;0:0.01;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;;; + ... 8 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --warning-storage-used=0.01 WARNING: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Storage usage: 114.00 GB | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;0:0.01;;; + ... 9 sql-bb-stsw-prod-do/elasticpools/sql-epool-bb-psme-prod-do emsp-tf-prod-va-rg --critical-storage-used=0.01 CRITICAL: Elastic Pool 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do' Statistic 'average' Metrics Storage usage: 114.00 GB | 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.bytes'=215822106624.00B;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.data.allocated.percentage'=67.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.usage.percentage'=38.00%;;;; 'sql-bb-stsw-prod-do/sql-epool-bb-psme-prod-do~average#elasticpool.storage.used.bytes'=122406567936.00B;;0:0.01;; + ... 10 ${EMPTY} ${EMPTY} ${EMPTY} UNKNOWN: Incorrect resource format