Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . cloudwatch ]

describe-alarms

Description

Retrieves the specified alarms. If no alarms are specified, all alarms are returned. Alarms can be retrieved by using only a prefix for the alarm name, the alarm state, or a prefix for any action.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

describe-alarms is a paginated operation. Multiple API calls may be issued in order to retrieve the entire data set of results. You can disable pagination by providing the --no-paginate argument. When using --output text and the --query argument on a paginated response, the --query argument must extract data from the results of the following query expressions: MetricAlarms

Synopsis

  describe-alarms
[--alarm-names <value>]
[--alarm-name-prefix <value>]
[--state-value <value>]
[--action-prefix <value>]
[--cli-input-json <value>]
[--starting-token <value>]
[--page-size <value>]
[--max-items <value>]
[--generate-cli-skeleton <value>]

Options

--alarm-names (list)

The names of the alarms.

Syntax:

"string" "string" ...

--alarm-name-prefix (string)

The alarm name prefix. If this parameter is specified, you cannot specify AlarmNames .

--state-value (string)

The state value to be used in matching alarms.

Possible values:

  • OK
  • ALARM
  • INSUFFICIENT_DATA

--action-prefix (string)

The action name prefix.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.

--starting-token (string)

A token to specify where to start paginating. This is the NextToken from a previously truncated response.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--page-size (integer)

The size of each page to get in the AWS service call. This does not affect the number of items returned in the command's output. Setting a smaller page size results in more calls to the AWS service, retrieving fewer items in each call. This can help prevent the AWS service calls from timing out.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--max-items (integer)

The total number of items to return in the command's output. If the total number of items available is more than the value specified, a NextToken is provided in the command's output. To resume pagination, provide the NextToken value in the starting-token argument of a subsequent command. Do not use the NextToken response element directly outside of the AWS CLI.

For usage examples, see Pagination in the AWS Command Line Interface User Guide .

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

See 'aws help' for descriptions of global parameters.

Examples

To list information about an alarm

The following example uses the describe-alarms command to provide information about the alarm named "myalarm":

aws cloudwatch describe-alarms --alarm-names "myalarm"

Output:

{
    "MetricAlarms": [
        {
            "EvaluationPeriods": 2,
            "AlarmArn": "arn:aws:cloudwatch:us-east-1:123456789012:alarm:myalarm",
            "StateUpdatedTimestamp": "2014-04-09T18:59:06.442Z",
            "AlarmConfigurationUpdatedTimestamp": "2012-12-27T00:49:54.032Z",
            "ComparisonOperator": "GreaterThanThreshold",
            "AlarmActions": [
                "arn:aws:sns:us-east-1:123456789012:myHighCpuAlarm"
            ],
            "Namespace": "AWS/EC2",
            "AlarmDescription": "CPU usage exceeds 70 percent",
            "StateReasonData": "{\"version\":\"1.0\",\"queryDate\":\"2014-04-09T18:59:06.419+0000\",\"startDate\":\"2014-04-09T18:44:00.000+0000\",\"statistic\":\"Average\",\"period\":300,\"recentDatapoints\":[38.958,40.292],\"threshold\":70.0}",
            "Period": 300,
            "StateValue": "OK",
            "Threshold": 70.0,
            "AlarmName": "myalarm",
            "Dimensions": [
                {
                    "Name": "InstanceId",
                    "Value": "i-0c986c72"
                }
            ],
            "Statistic": "Average",
            "StateReason": "Threshold Crossed: 2 datapoints were not greater than the threshold (70.0). The most recent datapoints: [38.958, 40.292].",
            "InsufficientDataActions": [],
            "OKActions": [],
            "ActionsEnabled": true,
            "MetricName": "CPUUtilization"
        }
    ]
}

Output

MetricAlarms -> (list)

The information for the specified alarms.

(structure)

Represents an alarm.

AlarmName -> (string)

The name of the alarm.

AlarmArn -> (string)

The Amazon Resource Name (ARN) of the alarm.

AlarmDescription -> (string)

The description of the alarm.

AlarmConfigurationUpdatedTimestamp -> (timestamp)

The time stamp of the last update to the alarm configuration.

ActionsEnabled -> (boolean)

Indicates whether actions should be executed during any changes to the alarm state.

OKActions -> (list)

The actions to execute when this alarm transitions to the OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).

(string)

AlarmActions -> (list)

The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).

(string)

InsufficientDataActions -> (list)

The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).

(string)

StateValue -> (string)

The state value for the alarm.

StateReason -> (string)

An explanation for the alarm state, in text format.

StateReasonData -> (string)

An explanation for the alarm state, in JSON format.

StateUpdatedTimestamp -> (timestamp)

The time stamp of the last update to the alarm state.

MetricName -> (string)

The name of the metric associated with the alarm.

Namespace -> (string)

The namespace of the metric associated with the alarm.

Statistic -> (string)

The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use ExtendedStatistic .

ExtendedStatistic -> (string)

The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.

Dimensions -> (list)

The dimensions for the metric associated with the alarm.

(structure)

Expands the identity of a metric.

Name -> (string)

The name of the dimension.

Value -> (string)

The value representing the dimension measurement.

Period -> (integer)

The period, in seconds, over which the statistic is applied.

Unit -> (string)

The unit of the metric associated with the alarm.

EvaluationPeriods -> (integer)

The number of periods over which data is compared to the specified threshold.

DatapointsToAlarm -> (integer)

The number of datapoints that must be breaching to trigger the alarm.

Threshold -> (double)

The value to compare with the specified statistic.

ComparisonOperator -> (string)

The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.

TreatMissingData -> (string)

Sets how this alarm is to handle missing data points. If this parameter is omitted, the default behavior of missing is used.

EvaluateLowSampleCountPercentile -> (string)

Used only for alarms based on percentiles. If ignore , the alarm state does not change during periods with too few data points to be statistically significant. If evaluate or this parameter is not used, the alarm is always evaluated and possibly changes state no matter how many data points are available.

Metrics -> (list)

(structure)

This structure is used in both GetMetricData and PutMetricAlarm . The supported use of this structure is different for those two operations.

When used in GetMetricData , it indicates the metric data to return, and whether this call is just retrieving a batch set of data for one metric, or is performing a math expression on metric data. A single GetMetricData call can include up to 100 MetricDataQuery structures.

When used in PutMetricAlarm , it enables you to create an alarm based on a metric math expression. Each MetricDataQuery in the array specifies either a metric to retrieve, or a math expression to be performed on retrieved metrics. A single PutMetricAlarm call can include up to 20 MetricDataQuery structures in the array. The 20 structures can include as many as 10 structures that contain a MetricStat parameter to retrieve a metric, and as many as 10 structures that contain the Expression parameter to perform a math expression. Of those Expression structures, one must have True as the value for ReturnData . The result of this expression is the value the alarm watches.

Any expression used in a PutMetricAlarm operation must return a single time series. For more information, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .

Some of the parameters of this structure also have different uses whether you are using this structure in a GetMetricData operation or a PutMetricAlarm operation. These differences are explained in the following parameter list.

Id -> (string)

A short name used to tie this object to the results in the response. This name must be unique within a single call to GetMetricData . If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscore. The first character must be a lowercase letter.

MetricStat -> (structure)

The metric to be returned, along with statistics, period, and units. Use this parameter only if this object is retrieving a metric and not performing a math expression on returned data.

Within one MetricDataQuery object, you must specify either Expression or MetricStat but not both.

Metric -> (structure)

The metric to return, including the metric name, namespace, and dimensions.

Namespace -> (string)

The namespace of the metric.

MetricName -> (string)

The name of the metric. This is a required field.

Dimensions -> (list)

The dimensions for the metric.

(structure)

Expands the identity of a metric.

Name -> (string)

The name of the dimension.

Value -> (string)

The value representing the dimension measurement.

Period -> (integer)

The period, in seconds, to use when retrieving the metric.

Stat -> (string)

The statistic to return. It can include any CloudWatch statistic or extended statistic.

Unit -> (string)

The unit to use for the returned data points.

Expression -> (string)

The math expression to be performed on the returned data, if this object is performing a math expression. This expression can use the Id of the other metrics to refer to those metrics, and can also use the Id of other expressions to use the result of those expressions. For more information about metric math expressions, see Metric Math Syntax and Functions in the Amazon CloudWatch User Guide .

Within each MetricDataQuery object, you must specify either Expression or MetricStat but not both.

Label -> (string)

A human-readable label for this metric or expression. This is especially useful if this is an expression, so that you know what the value represents. If the metric or expression is shown in a CloudWatch dashboard widget, the label is shown. If Label is omitted, CloudWatch generates a default.

ReturnData -> (boolean)

When used in GetMetricData , this option indicates whether to return the timestamps and raw data values of this metric. If you are performing this call just to do math expressions and do not also need the raw data returned, you can specify False . If you omit this, the default of True is used.

When used in PutMetricAlarm , specify True for the one expression result to use as the alarm. For all other metrics and expressions in the same PutMetricAlarm operation, specify ReturnData as False.

NextToken -> (string)

The token that marks the start of the next batch of returned results.