Enables group metrics collection for the specified Auto Scaling group.
You can use these metrics to track changes in an Auto Scaling group and to set alarms on threshold values. You can view group metrics using the Amazon EC2 Auto Scaling console or the CloudWatch console. For more information, see Monitor CloudWatch metrics for your Auto Scaling groups and instances in the Amazon EC2 Auto Scaling User Guide.
Parameters:
-
auto_scaling_group_name
(Optional[XmlStringMaxLen255], default:
None
)
–
The name of the Auto Scaling group.
-
metrics
(Optional[Metrics], default:
None
)
–
Identifies the metrics to enable.
You can specify one or more of the following metrics:
-
GroupMinSize
-
GroupMaxSize
-
GroupDesiredCapacity
-
GroupInServiceInstances
-
GroupPendingInstances
-
GroupStandbyInstances
-
GroupTerminatingInstances
-
GroupTotalInstances
-
GroupInServiceCapacity
-
GroupPendingCapacity
-
GroupStandbyCapacity
-
GroupTerminatingCapacity
-
GroupTotalCapacity
-
WarmPoolDesiredCapacity
-
WarmPoolWarmedCapacity
-
WarmPoolPendingCapacity
-
WarmPoolTerminatingCapacity
-
WarmPoolTotalCapacity
-
GroupAndWarmPoolDesiredCapacity
-
GroupAndWarmPoolTotalCapacity
If you specify Granularity and don't specify any metrics, all metrics are enabled.
For more information, see Amazon CloudWatch metrics for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
-
granularity
(Optional[XmlStringMaxLen255], default:
None
)
–
The frequency at which Amazon EC2 Auto Scaling sends aggregated data to CloudWatch. The only valid value is 1Minute.
Raises:
-
ResourceContentionFault
–
You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To enable metrics collection for an Auto Scaling group
This example enables data collection for the specified Auto Scaling group.
>>> await client.enable_metrics_collection(auto_scaling_group_name='my-auto-scaling-group', granularity='1Minute')
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
| async def enable_metrics_collection(
self,
*,
config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[
"capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
] = None,
metrics: Optional["capo_auto_scaling.types.metrics.Metrics"] = None,
granularity: Optional[
"capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
] = None,
) -> None:
"""<p>Enables group metrics collection for the specified Auto Scaling group.</p> <p>You can use these metrics to track changes in an Auto Scaling group and to set alarms on threshold values. You can view group metrics using the Amazon EC2 Auto Scaling console or the CloudWatch console. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html">Monitor CloudWatch metrics for your Auto Scaling groups and instances</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
Args:
auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
metrics: <p>Identifies the metrics to enable.</p> <p>You can specify one or more of the following metrics:</p> <ul> <li> <p> <code>GroupMinSize</code> </p> </li> <li> <p> <code>GroupMaxSize</code> </p> </li> <li> <p> <code>GroupDesiredCapacity</code> </p> </li> <li> <p> <code>GroupInServiceInstances</code> </p> </li> <li> <p> <code>GroupPendingInstances</code> </p> </li> <li> <p> <code>GroupStandbyInstances</code> </p> </li> <li> <p> <code>GroupTerminatingInstances</code> </p> </li> <li> <p> <code>GroupTotalInstances</code> </p> </li> <li> <p> <code>GroupInServiceCapacity</code> </p> </li> <li> <p> <code>GroupPendingCapacity</code> </p> </li> <li> <p> <code>GroupStandbyCapacity</code> </p> </li> <li> <p> <code>GroupTerminatingCapacity</code> </p> </li> <li> <p> <code>GroupTotalCapacity</code> </p> </li> <li> <p> <code>WarmPoolDesiredCapacity</code> </p> </li> <li> <p> <code>WarmPoolWarmedCapacity</code> </p> </li> <li> <p> <code>WarmPoolPendingCapacity</code> </p> </li> <li> <p> <code>WarmPoolTerminatingCapacity</code> </p> </li> <li> <p> <code>WarmPoolTotalCapacity</code> </p> </li> <li> <p> <code>GroupAndWarmPoolDesiredCapacity</code> </p> </li> <li> <p> <code>GroupAndWarmPoolTotalCapacity</code> </p> </li> </ul> <p>If you specify <code>Granularity</code> and don't specify any metrics, all metrics are enabled.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-metrics.html">Amazon CloudWatch metrics for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
granularity: <p>The frequency at which Amazon EC2 Auto Scaling sends aggregated data to CloudWatch. The only valid value is <code>1Minute</code>.</p>
Raises:
capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To enable metrics collection for an Auto Scaling group
This example enables data collection for the specified Auto Scaling group.
>>> await client.enable_metrics_collection(auto_scaling_group_name='my-auto-scaling-group', granularity='1Minute')
"""
async def _handler(
req: "AsyncOperationRequest[capo_auto_scaling.types.enable_metrics_collection_query.EnableMetricsCollectionQuery]",
) -> AsyncOperationResponse[None]:
import capo_auto_scaling._operations.auto_scaling_2011_01_01.enable_metrics_collection
(
output,
http_response,
) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.enable_metrics_collection.async_enable_metrics_collection(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("EnableMetricsCollection")
)
input_: capo_auto_scaling.types.enable_metrics_collection_query.EnableMetricsCollectionQuery = {}
if auto_scaling_group_name is not None:
input_["auto_scaling_group_name"] = auto_scaling_group_name
if metrics is not None:
input_["metrics"] = metrics
if granularity is not None:
input_["granularity"] = granularity
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|