AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

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

Inheritance Hierarchy

System.Object
  Amazon.CloudWatch.Model.MetricAlarm

Namespace: Amazon.CloudWatch.Model
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public class MetricAlarm : Object

The MetricAlarm type exposes the following members

Constructors

NameDescription
Public Method MetricAlarm()

Properties

NameTypeDescription
Public Property ActionsEnabled System.Boolean Gets and sets the property ActionsEnabled.

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

Public Property AlarmActions System.Collections.Generic.List<System.String> Gets and sets the property 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 Name (ARN).

Public Property AlarmArn System.String Gets and sets the property AlarmArn.

The Amazon Resource Name (ARN) of the alarm.

Public Property AlarmConfigurationUpdatedTimestamp System.DateTime Gets and sets the property AlarmConfigurationUpdatedTimestamp.

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

Public Property AlarmDescription System.String Gets and sets the property AlarmDescription.

The description for the alarm.

Public Property AlarmName System.String Gets and sets the property AlarmName.

The name of the alarm.

Public Property ComparisonOperator Amazon.CloudWatch.ComparisonOperator Gets and sets the property ComparisonOperator.

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

Public Property Dimensions System.Collections.Generic.List<Amazon.CloudWatch.Model.Dimension> Gets and sets the property Dimensions.

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

Public Property EvaluationPeriods System.Int32 Gets and sets the property EvaluationPeriods.

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

Public Property InsufficientDataActions System.Collections.Generic.List<System.String> Gets and sets the property 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 Name (ARN).

The current WSDL lists this attribute as UnknownActions.
Public Property MetricName System.String Gets and sets the property MetricName.

The name of the alarm's metric.

Public Property Namespace System.String Gets and sets the property Namespace.

The namespace of alarm's associated metric.

Public Property OKActions System.Collections.Generic.List<System.String> Gets and sets the property 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 Name (ARN).

Public Property Period System.Int32 Gets and sets the property Period.

The period in seconds over which the statistic is applied.

Public Property StateReason System.String Gets and sets the property StateReason.

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

Public Property StateReasonData System.String Gets and sets the property StateReasonData.

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

Public Property StateUpdatedTimestamp System.DateTime Gets and sets the property StateUpdatedTimestamp.

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

Public Property StateValue Amazon.CloudWatch.StateValue Gets and sets the property StateValue.

The state value for the alarm.

Public Property Statistic Amazon.CloudWatch.Statistic Gets and sets the property Statistic.

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

Public Property Threshold System.Double Gets and sets the property Threshold.

The value against which the specified statistic is compared.

Public Property Unit Amazon.CloudWatch.StandardUnit Gets and sets the property Unit.

The unit of the alarm's associated metric.

Examples

This example shows how to get information about an alarm.

Get alarm information example

var client = new AmazonCloudWatchClient();

var request = new DescribeAlarmsRequest
{
  AlarmNames = new List<string>() 
    { "awseb-e-b36EXAMPLE-stack-CloudwatchAlarmLow-1KAKH4EXAMPLE" },
  MaxRecords = 1,
  StateValue = StateValue.ALARM
};

var response = new DescribeAlarmsResponse();

do
{
  response = client.DescribeAlarms(request);

  foreach (var alarm in response.MetricAlarms)
  {
    Console.WriteLine(alarm.AlarmName);
    Console.WriteLine(alarm.AlarmDescription);
    Console.WriteLine(alarm.MetricName + " " +
        alarm.ComparisonOperator + " " + alarm.Threshold);
    Console.WriteLine();
  }

  request.NextToken = response.NextToken;

} while (!string.IsNullOrEmpty(response.NextToken));
      

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8