Skip to content

describe_anomaly_detectors

describe_anomaly_detectors(
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    anomaly_detector_ids: Optional[AnomalyDetectorIds] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxReturnedResultsCount] = None,
    namespace: Optional[Namespace] = None,
    metric_name: Optional[MetricName] = None,
    dimensions: Optional[Dimensions] = None,
    anomaly_detector_types: Optional[AnomalyDetectorTypes] = None,
) -> DescribeAnomalyDetectorsOutput

Lists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding METRIC_MATH to the AnomalyDetectorTypes array. This will return all metric math anomaly detectors in your account.

Parameters:

  • anomaly_detector_ids (Optional[AnomalyDetectorIds], default: None ) –

    Specifies the unique identifiers of the anomaly detectors to describe. You can specify up to 50 identifiers. If you specify this parameter, you cannot also specify the Namespace, MetricName, Dimensions, or AnomalyDetectorTypes metric filters.

  • next_token (Optional[NextToken], default: None ) –

    Use the token returned by the previous operation to request the next page of results.

  • max_results (Optional[MaxReturnedResultsCount], default: None ) –

    The maximum number of results to return in one operation. The maximum value that you can specify is 100.

    To retrieve the remaining results, make another call with the returned NextToken value.

  • namespace (Optional[Namespace], default: None ) –

    Limits the results to only the anomaly detection models that are associated with the specified namespace.

  • metric_name (Optional[MetricName], default: None ) –

    Limits the results to only the anomaly detection models that are associated with the specified metric name. If there are multiple metrics with this name in different namespaces that have anomaly detection models, they're all returned.

  • dimensions (Optional[Dimensions], default: None ) –

    Limits the results to only the anomaly detection models that are associated with the specified metric dimensions. If there are multiple metrics that have these dimensions and have anomaly detection models associated, they're all returned.

  • anomaly_detector_types (Optional[AnomalyDetectorTypes], default: None ) –

    The anomaly detector types to request when using DescribeAnomalyDetectorsInput. If empty, defaults to SINGLE_METRIC.

Raises:

Source code in docs_src/capo_cloudwatch/_services/cloud_watch.py
def describe_anomaly_detectors(
    self,
    *,
    config_overrides: Optional[CloudWatchClientConfig] = None,
    anomaly_detector_ids: Optional[
        "capo_cloudwatch.types.anomaly_detector_ids.AnomalyDetectorIds"
    ] = None,
    next_token: Optional["capo_cloudwatch.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_cloudwatch.types.max_returned_results_count.MaxReturnedResultsCount"
    ] = None,
    namespace: Optional["capo_cloudwatch.types.namespace.Namespace"] = None,
    metric_name: Optional["capo_cloudwatch.types.metric_name.MetricName"] = None,
    dimensions: Optional["capo_cloudwatch.types.dimensions.Dimensions"] = None,
    anomaly_detector_types: Optional[
        "capo_cloudwatch.types.anomaly_detector_types.AnomalyDetectorTypes"
    ] = None,
) -> "capo_cloudwatch.types.describe_anomaly_detectors_output.DescribeAnomalyDetectorsOutput":
    """<p>Lists the anomaly detection models that you have created in your account. For single metric anomaly detectors, you can list all of the models in your account or filter the results to only the models that are related to a certain namespace, metric name, or metric dimension. For metric math anomaly detectors, you can list them by adding <code>METRIC_MATH</code> to the <code>AnomalyDetectorTypes</code> array. This will return all metric math anomaly detectors in your account.</p>

    Args:
        anomaly_detector_ids: <p>Specifies the unique identifiers of the anomaly detectors to describe. You can specify up to 50 identifiers. If you specify this parameter, you cannot also specify the <code>Namespace</code>, <code>MetricName</code>, <code>Dimensions</code>, or <code>AnomalyDetectorTypes</code> metric filters.</p>
        next_token: <p>Use the token returned by the previous operation to request the next page of results.</p>
        max_results: <p>The maximum number of results to return in one operation. The maximum value that you can specify is 100.</p> <p>To retrieve the remaining results, make another call with the returned <code>NextToken</code> value. </p>
        namespace: <p>Limits the results to only the anomaly detection models that are associated with the specified namespace.</p>
        metric_name: <p>Limits the results to only the anomaly detection models that are associated with the specified metric name. If there are multiple metrics with this name in different namespaces that have anomaly detection models, they're all returned.</p>
        dimensions: <p>Limits the results to only the anomaly detection models that are associated with the specified metric dimensions. If there are multiple metrics that have these dimensions and have anomaly detection models associated, they're all returned.</p>
        anomaly_detector_types: <p>The anomaly detector types to request when using <code>DescribeAnomalyDetectorsInput</code>. If empty, defaults to <code>SINGLE_METRIC</code>.</p>

    Raises:
        capo_cloudwatch.errors.internal_service_fault.InternalServiceFault: <p>Request processing has failed due to some unknown error, exception, or failure.</p>
        capo_cloudwatch.errors.invalid_next_token.InvalidNextToken: <p>The next token specified is invalid.</p>
        capo_cloudwatch.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Parameters were used together that cannot be used together.</p>
        capo_cloudwatch.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of an input parameter is bad or out-of-range.</p>
        capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch.types.describe_anomaly_detectors_input.DescribeAnomalyDetectorsInput]",
    ) -> OperationResponse[
        "capo_cloudwatch.types.describe_anomaly_detectors_output.DescribeAnomalyDetectorsOutput"
    ]:
        import capo_cloudwatch._operations.granite_service_version20100801.describe_anomaly_detectors

        output, http_response = (
            capo_cloudwatch._operations.granite_service_version20100801.describe_anomaly_detectors.describe_anomaly_detectors(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeAnomalyDetectors")
    )
    input_: capo_cloudwatch.types.describe_anomaly_detectors_input.DescribeAnomalyDetectorsInput = {}
    if anomaly_detector_ids is not None:
        input_["anomaly_detector_ids"] = anomaly_detector_ids
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if namespace is not None:
        input_["namespace"] = namespace
    if metric_name is not None:
        input_["metric_name"] = metric_name
    if dimensions is not None:
        input_["dimensions"] = dimensions
    if anomaly_detector_types is not None:
        input_["anomaly_detector_types"] = anomaly_detector_types

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