Jump to Content

New API Documentation - Developer Preview Available

We are excited to announce the developer preview of our new API documentation for AWS SDK for JavaScript v3. Please follow instructions on the landing page to leave us your feedback.

Class DescribeAlarmsForMetricCommandProtected

Retrieves the alarms for the specified metric. To filter the results, specify a statistic, period, or unit.

This operation retrieves only standard alarms that are based on the specified metric. It does not return alarms based on math expressions that use the specified metric, or composite alarms that use the specified metric.

Example

Use a bare-bones client and the command you need to make an API call.

import { CloudWatchClient, DescribeAlarmsForMetricCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
// const { CloudWatchClient, DescribeAlarmsForMetricCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient(config);
const input = { // DescribeAlarmsForMetricInput
MetricName: "STRING_VALUE", // required
Namespace: "STRING_VALUE", // required
Statistic: "SampleCount" || "Average" || "Sum" || "Minimum" || "Maximum",
ExtendedStatistic: "STRING_VALUE",
Dimensions: [ // Dimensions
{ // Dimension
Name: "STRING_VALUE", // required
Value: "STRING_VALUE", // required
},
],
Period: Number("int"),
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",
};
const command = new DescribeAlarmsForMetricCommand(input);
const response = await client.send(command);
// { // DescribeAlarmsForMetricOutput
// MetricAlarms: [ // MetricAlarms
// { // MetricAlarm
// AlarmName: "STRING_VALUE",
// AlarmArn: "STRING_VALUE",
// AlarmDescription: "STRING_VALUE",
// AlarmConfigurationUpdatedTimestamp: new Date("TIMESTAMP"),
// ActionsEnabled: true || false,
// OKActions: [ // ResourceList
// "STRING_VALUE",
// ],
// AlarmActions: [
// "STRING_VALUE",
// ],
// InsufficientDataActions: [
// "STRING_VALUE",
// ],
// StateValue: "OK" || "ALARM" || "INSUFFICIENT_DATA",
// StateReason: "STRING_VALUE",
// StateReasonData: "STRING_VALUE",
// StateUpdatedTimestamp: new Date("TIMESTAMP"),
// MetricName: "STRING_VALUE",
// Namespace: "STRING_VALUE",
// Statistic: "SampleCount" || "Average" || "Sum" || "Minimum" || "Maximum",
// ExtendedStatistic: "STRING_VALUE",
// Dimensions: [ // Dimensions
// { // Dimension
// Name: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// Period: Number("int"),
// 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",
// EvaluationPeriods: Number("int"),
// DatapointsToAlarm: Number("int"),
// Threshold: Number("double"),
// ComparisonOperator: "GreaterThanOrEqualToThreshold" || "GreaterThanThreshold" || "LessThanThreshold" || "LessThanOrEqualToThreshold" || "LessThanLowerOrGreaterThanUpperThreshold" || "LessThanLowerThreshold" || "GreaterThanUpperThreshold",
// TreatMissingData: "STRING_VALUE",
// EvaluateLowSampleCountPercentile: "STRING_VALUE",
// Metrics: [ // MetricDataQueries
// { // MetricDataQuery
// Id: "STRING_VALUE", // required
// MetricStat: { // MetricStat
// Metric: { // Metric
// Namespace: "STRING_VALUE",
// MetricName: "STRING_VALUE",
// Dimensions: [
// {
// Name: "STRING_VALUE", // required
// Value: "STRING_VALUE", // required
// },
// ],
// },
// 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",
// },
// ],
// ThresholdMetricId: "STRING_VALUE",
// EvaluationState: "PARTIAL_DATA",
// StateTransitionedTimestamp: new Date("TIMESTAMP"),
// },
// ],
// };

Param

DescribeAlarmsForMetricCommandInput

Returns

DescribeAlarmsForMetricCommandOutput

See

Throws

CloudWatchServiceException

Base exception class for all service exceptions from CloudWatch service.

Hierarchy

Constructors

Properties

Methods