Skip to content

disable_metrics_collection

disable_metrics_collection(
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    metrics: Optional[Metrics] = None,
) -> None

Disables group metrics collection for the specified Auto Scaling group.

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 disable.

    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 omit this property, all metrics are disabled.

    For more information, see Amazon CloudWatch metrics for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

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 disable metrics collection for an Auto Scaling group This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group.

>>> client.disable_metrics_collection(auto_scaling_group_name='my-auto-scaling-group', metrics=['GroupDesiredCapacity'])
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
def disable_metrics_collection(
    self,
    *,
    config_overrides: Optional[AutoScalingClientConfig] = 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,
) -> None:
    """<p>Disables group metrics collection for the specified Auto Scaling group.</p>

    Args:
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        metrics: <p>Identifies the metrics to disable.</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 omit this property, all metrics are disabled.</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>

    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 disable metrics collection for an Auto Scaling group
        This example disables collecting data for the GroupDesiredCapacity metric for the specified Auto Scaling group.

        >>> client.disable_metrics_collection(auto_scaling_group_name='my-auto-scaling-group', metrics=['GroupDesiredCapacity'])
    """

    def _handler(
        req: "OperationRequest[capo_auto_scaling.types.disable_metrics_collection_query.DisableMetricsCollectionQuery]",
    ) -> OperationResponse[None]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.disable_metrics_collection

        output, http_response = (
            capo_auto_scaling._operations.auto_scaling_2011_01_01.disable_metrics_collection.disable_metrics_collection(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DisableMetricsCollection")
    )
    input_: capo_auto_scaling.types.disable_metrics_collection_query.DisableMetricsCollectionQuery = {}
    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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output