Amazon CloudWatch

2015/05/07 - Amazon CloudWatch - 11 new api methods

ListMetrics (new) Link ¶

Returns a list of valid metrics stored for the AWS account owner. Returned metrics can be used with GetMetricStatistics to obtain statistical data for a given metric.

Request Syntax

client.list_metrics(
    Namespace='string',
    MetricName='string',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    NextToken='string'
)
type Namespace:

string

param Namespace:

The namespace to filter against.

type MetricName:

string

param MetricName:

The name of the metric to filter against.

type Dimensions:

list

param Dimensions:

A list of dimensions to filter against.

  • (dict) --

    The DimensionFilter data type is used to filter ListMetrics results.

    • Name (string) -- [REQUIRED]

      The dimension name to be matched.

    • Value (string) --

      The value of the dimension to be matched.

type NextToken:

string

param NextToken:

The token returned by a previous call to indicate that there is more data available.

rtype:

dict

returns:

Response Syntax

{
    'Metrics': [
        {
            'Namespace': 'string',
            'MetricName': 'string',
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The output for the ListMetrics action.

    • Metrics (list) --

      A list of metrics used to generate statistics for an AWS account.

      • (dict) --

        The Metric data type contains information about a specific metric. If you call ListMetrics, Amazon CloudWatch returns information contained by this data type.

        The example in the Examples section publishes two metrics named buffers and latency. Both metrics are in the examples namespace. Both metrics have two dimensions, InstanceID and InstanceType.

        • Namespace (string) --

          The namespace of the metric.

        • MetricName (string) --

          The name of the metric.

        • Dimensions (list) --

          A list of dimensions associated with the metric.

          • (dict) --

            The Dimension data type further expands on the identity of a metric using a Name, Value pair.

            For examples that use one or more dimensions, see PutMetricData.

            • Name (string) --

              The name of the dimension.

            • Value (string) --

              The value representing the dimension measurement

    • NextToken (string) --

      A string that marks the start of the next batch of returned results.

DescribeAlarms (new) Link ¶

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

Request Syntax

client.describe_alarms(
    AlarmNames=[
        'string',
    ],
    AlarmNamePrefix='string',
    StateValue='OK'|'ALARM'|'INSUFFICIENT_DATA',
    ActionPrefix='string',
    MaxRecords=123,
    NextToken='string'
)
type AlarmNames:

list

param AlarmNames:

A list of alarm names to retrieve information for.

  • (string) --

type AlarmNamePrefix:

string

param AlarmNamePrefix:

The alarm name prefix. AlarmNames cannot be specified if this parameter is specified.

type StateValue:

string

param StateValue:

The state value to be used in matching alarms.

type ActionPrefix:

string

param ActionPrefix:

The action name prefix.

type MaxRecords:

integer

param MaxRecords:

The maximum number of alarm descriptions to retrieve.

type NextToken:

string

param NextToken:

The token returned by a previous call to indicate that there is more data available.

rtype:

dict

returns:

Response Syntax

{
    'MetricAlarms': [
        {
            'AlarmName': 'string',
            'AlarmArn': 'string',
            'AlarmDescription': 'string',
            'AlarmConfigurationUpdatedTimestamp': datetime(2015, 1, 1),
            'ActionsEnabled': True|False,
            'OKActions': [
                'string',
            ],
            'AlarmActions': [
                'string',
            ],
            'InsufficientDataActions': [
                'string',
            ],
            'StateValue': 'OK'|'ALARM'|'INSUFFICIENT_DATA',
            'StateReason': 'string',
            'StateReasonData': 'string',
            'StateUpdatedTimestamp': datetime(2015, 1, 1),
            'MetricName': 'string',
            'Namespace': 'string',
            'Statistic': 'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ],
            'Period': 123,
            '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': 123,
            'Threshold': 123.0,
            'ComparisonOperator': 'GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The output for the DescribeAlarms action.

    • MetricAlarms (list) --

      A list of information for the specified alarms.

      • (dict) --

        The MetricAlarm data type represents an alarm. You can use PutMetricAlarm to create or update an alarm.

        • AlarmName (string) --

          The name of the alarm.

        • AlarmArn (string) --

          The Amazon Resource Name (ARN) of the alarm.

        • AlarmDescription (string) --

          The description for the alarm.

        • AlarmConfigurationUpdatedTimestamp (datetime) --

          The time stamp of the last update to the alarm configuration. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • ActionsEnabled (boolean) --

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

        • OKActions (list) --

          The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic and triggering an Auto Scaling policy.

          • (string) --

        • AlarmActions (list) --

          The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic and triggering an Auto Scaling policy.

          • (string) --

        • InsufficientDataActions (list) --

          The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic or triggering an Auto Scaling policy.

          • (string) --

        • StateValue (string) --

          The state value for the alarm.

        • StateReason (string) --

          A human-readable explanation for the alarm's state.

        • StateReasonData (string) --

          An explanation for the alarm's state in machine-readable JSON format

        • StateUpdatedTimestamp (datetime) --

          The time stamp of the last update to the alarm's state. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • MetricName (string) --

          The name of the alarm's metric.

        • Namespace (string) --

          The namespace of alarm's associated metric.

        • Statistic (string) --

          The statistic to apply to the alarm's associated metric.

        • Dimensions (list) --

          The list of dimensions associated with the alarm's associated metric.

          • (dict) --

            The Dimension data type further expands on the identity of a metric using a Name, Value pair.

            For examples that use one or more dimensions, see PutMetricData.

            • 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 alarm's associated metric.

        • EvaluationPeriods (integer) --

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

        • Threshold (float) --

          The value against which the specified statistic is compared.

        • ComparisonOperator (string) --

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

    • NextToken (string) --

      A string that marks the start of the next batch of returned results.

DisableAlarmActions (new) Link ¶

Disables actions for the specified alarms. When an alarm's actions are disabled the alarm's state may change, but none of the alarm's actions will execute.

Request Syntax

client.disable_alarm_actions(
    AlarmNames=[
        'string',
    ]
)
type AlarmNames:

list

param AlarmNames:

[REQUIRED]

The names of the alarms to disable actions for.

  • (string) --

returns:

None

SetAlarmState (new) Link ¶

Temporarily sets the state of an alarm. When the updated StateValue differs from the previous value, the action configured for the appropriate state is invoked. This is not a permanent change. The next periodic alarm check (in about a minute) will set the alarm to its actual state.

Request Syntax

client.set_alarm_state(
    AlarmName='string',
    StateValue='OK'|'ALARM'|'INSUFFICIENT_DATA',
    StateReason='string',
    StateReasonData='string'
)
type AlarmName:

string

param AlarmName:

[REQUIRED]

The descriptive name for the alarm. This name must be unique within the user's AWS account. The maximum length is 255 characters.

type StateValue:

string

param StateValue:

[REQUIRED]

The value of the state.

type StateReason:

string

param StateReason:

[REQUIRED]

The reason that this alarm is set to this specific state (in human-readable text format)

type StateReasonData:

string

param StateReasonData:

The reason that this alarm is set to this specific state (in machine-readable JSON format)

returns:

None

EnableAlarmActions (new) Link ¶

Enables actions for the specified alarms.

Request Syntax

client.enable_alarm_actions(
    AlarmNames=[
        'string',
    ]
)
type AlarmNames:

list

param AlarmNames:

[REQUIRED]

The names of the alarms to enable actions for.

  • (string) --

returns:

None

GetMetricStatistics (new) Link ¶

Gets statistics for the specified metric.

The maximum number of data points returned from a single GetMetricStatistics request is 1,440, wereas the maximum number of data points that can be queried is 50,850. If you make a request that generates more than 1,440 data points, Amazon CloudWatch returns an error. In such a case, you can alter the request by narrowing the specified time range or increasing the specified period. Alternatively, you can make multiple requests across adjacent time ranges.

Amazon CloudWatch aggregates data points based on the length of the period that you specify. For example, if you request statistics with a one-minute granularity, Amazon CloudWatch aggregates data points with time stamps that fall within the same one-minute period. In such a case, the data points queried can greatly outnumber the data points returned.

The following examples show various statistics allowed by the data point query maximum of 50,850 when you call GetMetricStatistics on Amazon EC2 instances with detailed (one-minute) monitoring enabled:

  • Statistics for up to 400 instances for a span of one hour

  • Statistics for up to 35 instances over a span of 24 hours

  • Statistics for up to 2 instances over a span of 2 weeks

For information about the namespace, metric names, and dimensions that other Amazon Web Services products use to send metrics to Cloudwatch, go to Amazon CloudWatch Metrics, Namespaces, and Dimensions Reference in the Amazon CloudWatch Developer Guide.

Request Syntax

client.get_metric_statistics(
    Namespace='string',
    MetricName='string',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    StartTime=datetime(2015, 1, 1),
    EndTime=datetime(2015, 1, 1),
    Period=123,
    Statistics=[
        'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
    ],
    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'
)
type Namespace:

string

param Namespace:

[REQUIRED]

The namespace of the metric, with or without spaces.

type MetricName:

string

param MetricName:

[REQUIRED]

The name of the metric, with or without spaces.

type Dimensions:

list

param Dimensions:

A list of dimensions describing qualities of the metric.

  • (dict) --

    The Dimension data type further expands on the identity of a metric using a Name, Value pair.

    For examples that use one or more dimensions, see PutMetricData.

    • Name (string) -- [REQUIRED]

      The name of the dimension.

    • Value (string) -- [REQUIRED]

      The value representing the dimension measurement

type StartTime:

datetime

param StartTime:

[REQUIRED]

The time stamp to use for determining the first datapoint to return. The value specified is inclusive; results include datapoints with the time stamp specified.

type EndTime:

datetime

param EndTime:

[REQUIRED]

The time stamp to use for determining the last datapoint to return. The value specified is exclusive; results will include datapoints up to the time stamp specified.

type Period:

integer

param Period:

[REQUIRED]

The granularity, in seconds, of the returned datapoints. Period must be at least 60 seconds and must be a multiple of 60. The default value is 60.

type Statistics:

list

param Statistics:

[REQUIRED]

The metric statistics to return. For information about specific statistics returned by GetMetricStatistics, go to Statistics in the Amazon CloudWatch Developer Guide.

Valid Values: Average | Sum | SampleCount | Maximum | Minimum

  • (string) --

type Unit:

string

param Unit:

The unit for the metric.

rtype:

dict

returns:

Response Syntax

{
    'Label': 'string',
    'Datapoints': [
        {
            'Timestamp': datetime(2015, 1, 1),
            'SampleCount': 123.0,
            'Average': 123.0,
            'Sum': 123.0,
            'Minimum': 123.0,
            'Maximum': 123.0,
            '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'
        },
    ]
}

Response Structure

  • (dict) --

    The output for the GetMetricStatistics action.

    • Label (string) --

      A label describing the specified metric.

    • Datapoints (list) --

      The datapoints for the specified metric.

      • (dict) --

        The Datapoint data type encapsulates the statistical data that Amazon CloudWatch computes from metric data.

        • Timestamp (datetime) --

          The time stamp used for the datapoint. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • SampleCount (float) --

          The number of metric values that contributed to the aggregate value of this datapoint.

        • Average (float) --

          The average of metric values that correspond to the datapoint.

        • Sum (float) --

          The sum of metric values used for the datapoint.

        • Minimum (float) --

          The minimum metric value used for the datapoint.

        • Maximum (float) --

          The maximum of the metric value used for the datapoint.

        • Unit (string) --

          The standard unit used for the datapoint.

DeleteAlarms (new) Link ¶

Deletes all specified alarms. In the event of an error, no alarms are deleted.

Request Syntax

client.delete_alarms(
    AlarmNames=[
        'string',
    ]
)
type AlarmNames:

list

param AlarmNames:

[REQUIRED]

A list of alarms to be deleted.

  • (string) --

returns:

None

PutMetricData (new) Link ¶

Publishes metric data points to Amazon CloudWatch. Amazon Cloudwatch associates the data points with the specified metric. If the specified metric does not exist, Amazon CloudWatch creates the metric. It can take up to fifteen minutes for a new metric to appear in calls to the ListMetrics action.

The size of a PutMetricData request is limited to 8 KB for HTTP GET requests and 40 KB for HTTP POST requests.

Data that is timestamped 24 hours or more in the past may take in excess of 48 hours to become available from submission time using GetMetricStatistics.

Request Syntax

client.put_metric_data(
    Namespace='string',
    MetricData=[
        {
            'MetricName': 'string',
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ],
            'Timestamp': datetime(2015, 1, 1),
            'Value': 123.0,
            'StatisticValues': {
                'SampleCount': 123.0,
                'Sum': 123.0,
                'Minimum': 123.0,
                'Maximum': 123.0
            },
            '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'
        },
    ]
)
type Namespace:

string

param Namespace:

[REQUIRED]

The namespace for the metric data.

type MetricData:

list

param MetricData:

[REQUIRED]

A list of data describing the metric.

  • (dict) --

    The MetricDatum data type encapsulates the information sent with PutMetricData to either create a new metric or add new values to be aggregated into an existing metric.

    • MetricName (string) -- [REQUIRED]

      The name of the metric.

    • Dimensions (list) --

      A list of dimensions associated with the metric. Note, when using the Dimensions value in a query, you need to append .member.N to it (e.g., Dimensions.member.N).

      • (dict) --

        The Dimension data type further expands on the identity of a metric using a Name, Value pair.

        For examples that use one or more dimensions, see PutMetricData.

        • Name (string) -- [REQUIRED]

          The name of the dimension.

        • Value (string) -- [REQUIRED]

          The value representing the dimension measurement

    • Timestamp (datetime) --

      The time stamp used for the metric. If not specified, the default value is set to the time the metric data was received. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

    • Value (float) --

      The value for the metric.

    • StatisticValues (dict) --

      A set of statistical values describing the metric.

      • SampleCount (float) -- [REQUIRED]

        The number of samples used for the statistic set.

      • Sum (float) -- [REQUIRED]

        The sum of values for the sample set.

      • Minimum (float) -- [REQUIRED]

        The minimum value of the sample set.

      • Maximum (float) -- [REQUIRED]

        The maximum value of the sample set.

    • Unit (string) --

      The unit of the metric.

returns:

None

DescribeAlarmsForMetric (new) Link ¶

Retrieves all alarms for a single metric. Specify a statistic, period, or unit to filter the set of alarms further.

Request Syntax

client.describe_alarms_for_metric(
    MetricName='string',
    Namespace='string',
    Statistic='SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    Period=123,
    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'
)
type MetricName:

string

param MetricName:

[REQUIRED]

The name of the metric.

type Namespace:

string

param Namespace:

[REQUIRED]

The namespace of the metric.

type Statistic:

string

param Statistic:

The statistic for the metric.

type Dimensions:

list

param Dimensions:

The list of dimensions associated with the metric.

  • (dict) --

    The Dimension data type further expands on the identity of a metric using a Name, Value pair.

    For examples that use one or more dimensions, see PutMetricData.

    • Name (string) -- [REQUIRED]

      The name of the dimension.

    • Value (string) -- [REQUIRED]

      The value representing the dimension measurement

type Period:

integer

param Period:

The period in seconds over which the statistic is applied.

type Unit:

string

param Unit:

The unit for the metric.

rtype:

dict

returns:

Response Syntax

{
    'MetricAlarms': [
        {
            'AlarmName': 'string',
            'AlarmArn': 'string',
            'AlarmDescription': 'string',
            'AlarmConfigurationUpdatedTimestamp': datetime(2015, 1, 1),
            'ActionsEnabled': True|False,
            'OKActions': [
                'string',
            ],
            'AlarmActions': [
                'string',
            ],
            'InsufficientDataActions': [
                'string',
            ],
            'StateValue': 'OK'|'ALARM'|'INSUFFICIENT_DATA',
            'StateReason': 'string',
            'StateReasonData': 'string',
            'StateUpdatedTimestamp': datetime(2015, 1, 1),
            'MetricName': 'string',
            'Namespace': 'string',
            'Statistic': 'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
            'Dimensions': [
                {
                    'Name': 'string',
                    'Value': 'string'
                },
            ],
            'Period': 123,
            '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': 123,
            'Threshold': 123.0,
            'ComparisonOperator': 'GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold'
        },
    ]
}

Response Structure

  • (dict) --

    The output for the DescribeAlarmsForMetric action.

    • MetricAlarms (list) --

      A list of information for each alarm with the specified metric.

      • (dict) --

        The MetricAlarm data type represents an alarm. You can use PutMetricAlarm to create or update an alarm.

        • AlarmName (string) --

          The name of the alarm.

        • AlarmArn (string) --

          The Amazon Resource Name (ARN) of the alarm.

        • AlarmDescription (string) --

          The description for the alarm.

        • AlarmConfigurationUpdatedTimestamp (datetime) --

          The time stamp of the last update to the alarm configuration. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • ActionsEnabled (boolean) --

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

        • OKActions (list) --

          The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic and triggering an Auto Scaling policy.

          • (string) --

        • AlarmActions (list) --

          The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic and triggering an Auto Scaling policy.

          • (string) --

        • InsufficientDataActions (list) --

          The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only actions supported are publishing to an Amazon SNS topic or triggering an Auto Scaling policy.

          • (string) --

        • StateValue (string) --

          The state value for the alarm.

        • StateReason (string) --

          A human-readable explanation for the alarm's state.

        • StateReasonData (string) --

          An explanation for the alarm's state in machine-readable JSON format

        • StateUpdatedTimestamp (datetime) --

          The time stamp of the last update to the alarm's state. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • MetricName (string) --

          The name of the alarm's metric.

        • Namespace (string) --

          The namespace of alarm's associated metric.

        • Statistic (string) --

          The statistic to apply to the alarm's associated metric.

        • Dimensions (list) --

          The list of dimensions associated with the alarm's associated metric.

          • (dict) --

            The Dimension data type further expands on the identity of a metric using a Name, Value pair.

            For examples that use one or more dimensions, see PutMetricData.

            • 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 alarm's associated metric.

        • EvaluationPeriods (integer) --

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

        • Threshold (float) --

          The value against which the specified statistic is compared.

        • ComparisonOperator (string) --

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

PutMetricAlarm (new) Link ¶

Creates or updates an alarm and associates it with the specified Amazon CloudWatch metric. Optionally, this operation can associate one or more Amazon Simple Notification Service resources with the alarm.

When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA. The alarm is evaluated and its StateValue is set appropriately. Any actions associated with the StateValue is then executed.

Request Syntax

client.put_metric_alarm(
    AlarmName='string',
    AlarmDescription='string',
    ActionsEnabled=True|False,
    OKActions=[
        'string',
    ],
    AlarmActions=[
        'string',
    ],
    InsufficientDataActions=[
        'string',
    ],
    MetricName='string',
    Namespace='string',
    Statistic='SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
    Dimensions=[
        {
            'Name': 'string',
            'Value': 'string'
        },
    ],
    Period=123,
    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=123,
    Threshold=123.0,
    ComparisonOperator='GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold'
)
type AlarmName:

string

param AlarmName:

[REQUIRED]

The descriptive name for the alarm. This name must be unique within the user's AWS account

type AlarmDescription:

string

param AlarmDescription:

The description for the alarm.

type ActionsEnabled:

boolean

param ActionsEnabled:

Indicates whether or not actions should be executed during any changes to the alarm's state.

type OKActions:

list

param OKActions:

The list of actions to execute when this alarm transitions into an OK state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only action supported is publishing to an Amazon SNS topic or an Amazon Auto Scaling policy.

  • (string) --

type AlarmActions:

list

param AlarmActions:

The list of actions to execute when this alarm transitions into an ALARM state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only action supported is publishing to an Amazon SNS topic or an Amazon Auto Scaling policy.

  • (string) --

type InsufficientDataActions:

list

param InsufficientDataActions:

The list of actions to execute when this alarm transitions into an INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Number (ARN). Currently the only action supported is publishing to an Amazon SNS topic or an Amazon Auto Scaling policy.

  • (string) --

type MetricName:

string

param MetricName:

[REQUIRED]

The name for the alarm's associated metric.

type Namespace:

string

param Namespace:

[REQUIRED]

The namespace for the alarm's associated metric.

type Statistic:

string

param Statistic:

[REQUIRED]

The statistic to apply to the alarm's associated metric.

type Dimensions:

list

param Dimensions:

The dimensions for the alarm's associated metric.

  • (dict) --

    The Dimension data type further expands on the identity of a metric using a Name, Value pair.

    For examples that use one or more dimensions, see PutMetricData.

    • Name (string) -- [REQUIRED]

      The name of the dimension.

    • Value (string) -- [REQUIRED]

      The value representing the dimension measurement

type Period:

integer

param Period:

[REQUIRED]

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

type Unit:

string

param Unit:

The unit for the alarm's associated metric.

type EvaluationPeriods:

integer

param EvaluationPeriods:

[REQUIRED]

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

type Threshold:

float

param Threshold:

[REQUIRED]

The value against which the specified statistic is compared.

type ComparisonOperator:

string

param ComparisonOperator:

[REQUIRED]

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

returns:

None

DescribeAlarmHistory (new) Link ¶

Retrieves history for the specified alarm. Filter alarms by date range or item type. If an alarm name is not specified, Amazon CloudWatch returns histories for all of the owner's alarms.

Request Syntax

client.describe_alarm_history(
    AlarmName='string',
    HistoryItemType='ConfigurationUpdate'|'StateUpdate'|'Action',
    StartDate=datetime(2015, 1, 1),
    EndDate=datetime(2015, 1, 1),
    MaxRecords=123,
    NextToken='string'
)
type AlarmName:

string

param AlarmName:

The name of the alarm.

type HistoryItemType:

string

param HistoryItemType:

The type of alarm histories to retrieve.

type StartDate:

datetime

param StartDate:

The starting date to retrieve alarm history.

type EndDate:

datetime

param EndDate:

The ending date to retrieve alarm history.

type MaxRecords:

integer

param MaxRecords:

The maximum number of alarm history records to retrieve.

type NextToken:

string

param NextToken:

The token returned by a previous call to indicate that there is more data available.

rtype:

dict

returns:

Response Syntax

{
    'AlarmHistoryItems': [
        {
            'AlarmName': 'string',
            'Timestamp': datetime(2015, 1, 1),
            'HistoryItemType': 'ConfigurationUpdate'|'StateUpdate'|'Action',
            'HistorySummary': 'string',
            'HistoryData': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    The output for the DescribeAlarmHistory action.

    • AlarmHistoryItems (list) --

      A list of alarm histories in JSON format.

      • (dict) --

        The AlarmHistoryItem data type contains descriptive information about the history of a specific alarm. If you call DescribeAlarmHistory, Amazon CloudWatch returns this data type as part of the DescribeAlarmHistoryResult data type.

        • AlarmName (string) --

          The descriptive name for the alarm.

        • Timestamp (datetime) --

          The time stamp for the alarm history item. Amazon CloudWatch uses Coordinated Universal Time (UTC) when returning time stamps, which do not accommodate seasonal adjustments such as daylight savings time. For more information, see Time stamps in the Amazon CloudWatch Developer Guide.

        • HistoryItemType (string) --

          The type of alarm history item.

        • HistorySummary (string) --

          A human-readable summary of the alarm history.

        • HistoryData (string) --

          Machine-readable data about the alarm in JSON format.

    • NextToken (string) --

      A string that marks the start of the next batch of returned results.