- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
DescribeAnomalyDetectorsCommand
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.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { CloudWatchClient, DescribeAnomalyDetectorsCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
// const { CloudWatchClient, DescribeAnomalyDetectorsCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient(config);
const input = { // DescribeAnomalyDetectorsInput
NextToken: "STRING_VALUE",
MaxResults: Number("int"),
Namespace: "STRING_VALUE",
MetricName: "STRING_VALUE",
Dimensions: [ // Dimensions
{ // Dimension
Name: "STRING_VALUE", // required
Value: "STRING_VALUE", // required
},
],
AnomalyDetectorTypes: [ // AnomalyDetectorTypes
"SINGLE_METRIC" || "METRIC_MATH",
],
};
const command = new DescribeAnomalyDetectorsCommand(input);
const response = await client.send(command);
// { // DescribeAnomalyDetectorsOutput
// AnomalyDetectors: [ // AnomalyDetectors
// { // AnomalyDetector
// Namespace: "STRING_VALUE",
// MetricName: "STRING_VALUE",
// Dimensions: [ // Dimensions
// { // Dimension
// Name: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// Stat: "STRING_VALUE",
// Configuration: { // AnomalyDetectorConfiguration
// ExcludedTimeRanges: [ // AnomalyDetectorExcludedTimeRanges
// { // Range
// StartTime: new Date("TIMESTAMP"), // required
// EndTime: new Date("TIMESTAMP"), // required
// },
// ],
// MetricTimezone: "STRING_VALUE",
// },
// StateValue: "PENDING_TRAINING" || "TRAINED_INSUFFICIENT_DATA" || "TRAINED",
// MetricCharacteristics: { // MetricCharacteristics
// PeriodicSpikes: true || false,
// },
// SingleMetricAnomalyDetector: { // SingleMetricAnomalyDetector
// AccountId: "STRING_VALUE",
// Namespace: "STRING_VALUE",
// MetricName: "STRING_VALUE",
// Dimensions: [
// {
// Name: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// Stat: "STRING_VALUE",
// },
// MetricMathAnomalyDetector: { // MetricMathAnomalyDetector
// MetricDataQueries: [ // MetricDataQueries
// { // MetricDataQuery
// Id: "STRING_VALUE", // required
// MetricStat: { // MetricStat
// Metric: { // Metric
// Namespace: "STRING_VALUE",
// MetricName: "STRING_VALUE",
// Dimensions: "<Dimensions>",
// },
// Period: Number("int"), // required
// Stat: "STRING_VALUE", // required
// Unit: "Seconds" || "Microseconds" || "Milliseconds" || "Bytes" || "Kilobytes" || "Megabytes" || "Gigabytes" || "Terabytes" || "Bits" || "Kilobits" || "Megabits" || "Gigabits" || "Terabits" || "Percent" || "Count" || "Bytes/Second" || "Kilobytes/Second" || "Megabytes/Second" || "Gigabytes/Second" || "Terabytes/Second" || "Bits/Second" || "Kilobits/Second" || "Megabits/Second" || "Gigabits/Second" || "Terabits/Second" || "Count/Second" || "None",
// },
// Expression: "STRING_VALUE",
// Label: "STRING_VALUE",
// ReturnData: true || false,
// Period: Number("int"),
// AccountId: "STRING_VALUE",
// },
// ],
// },
// },
// ],
// NextToken: "STRING_VALUE",
// };
DescribeAnomalyDetectorsCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
AnomalyDetectorTypes | AnomalyDetectorType[] | undefined | The anomaly detector types to request when using |
Dimensions | Dimension[] | undefined | 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. |
MaxResults | number | undefined | 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 |
MetricName | string | undefined | 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. |
Namespace | string | undefined | Limits the results to only the anomaly detection models that are associated with the specified namespace. |
NextToken | string | undefined | Use the token returned by the previous operation to request the next page of results. |
DescribeAnomalyDetectorsCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
AnomalyDetectors | AnomalyDetector[] | undefined | The list of anomaly detection models returned by the operation. |
NextToken | string | undefined | A token that you can use in a subsequent operation to retrieve the next set of results. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalServiceFault | server | Request processing has failed due to some unknown error, exception, or failure. |
InvalidNextToken | client | The next token specified is invalid. |
InvalidParameterCombinationException | client | Parameters were used together that cannot be used together. |
InvalidParameterValueException | client | The value of an input parameter is bad or out-of-range. |
CloudWatchServiceException | Base exception class for all service exceptions from CloudWatch service. |