Class CfnAlarm
The AWS::CloudWatch::Alarm
type specifies an alarm and associates it with the specified metric or metric math expression.
Inherited Members
Namespace: Amazon.CDK.AWS.CloudWatch
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnAlarm : CfnResource, IInspectable, ITaggableV2
Syntax (vb)
Public Class CfnAlarm
Inherits CfnResource
Implements IInspectable, ITaggableV2
Remarks
When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA
. The alarm is then evaluated and its state is set appropriately. Any actions associated with the new state are then executed.
When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
See: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-alarm.html
CloudformationResource: AWS::CloudWatch::Alarm
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudWatch;
var cfnAlarm = new CfnAlarm(this, "MyCfnAlarm", new CfnAlarmProps {
ComparisonOperator = "comparisonOperator",
EvaluationPeriods = 123,
// the properties below are optional
ActionsEnabled = false,
AlarmActions = new [] { "alarmActions" },
AlarmDescription = "alarmDescription",
AlarmName = "alarmName",
DatapointsToAlarm = 123,
Dimensions = new [] { new DimensionProperty {
Name = "name",
Value = "value"
} },
EvaluateLowSampleCountPercentile = "evaluateLowSampleCountPercentile",
ExtendedStatistic = "extendedStatistic",
InsufficientDataActions = new [] { "insufficientDataActions" },
MetricName = "metricName",
Metrics = new [] { new MetricDataQueryProperty {
Id = "id",
// the properties below are optional
AccountId = "accountId",
Expression = "expression",
Label = "label",
MetricStat = new MetricStatProperty {
Metric = new MetricProperty {
Dimensions = new [] { new DimensionProperty {
Name = "name",
Value = "value"
} },
MetricName = "metricName",
Namespace = "namespace"
},
Period = 123,
Stat = "stat",
// the properties below are optional
Unit = "unit"
},
Period = 123,
ReturnData = false
} },
Namespace = "namespace",
OkActions = new [] { "okActions" },
Period = 123,
Statistic = "statistic",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} },
Threshold = 123,
ThresholdMetricId = "thresholdMetricId",
TreatMissingData = "treatMissingData",
Unit = "unit"
});
Synopsis
Constructors
CfnAlarm(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnAlarm(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnAlarm(Construct, String, ICfnAlarmProps) |
Properties
ActionsEnabled | Indicates whether actions should be executed during any changes to the alarm state. |
AlarmActions | The list of actions to execute when this alarm transitions into an ALARM state from any other state. |
AlarmDescription | The description of the alarm. |
AlarmName | The name of the alarm. |
AttrArn | The ARN of the CloudWatch alarm, such as |
CdkTagManager | Tag Manager which manages the tags for this resource. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
ComparisonOperator | The arithmetic operation to use when comparing the specified statistic and threshold. |
DatapointsToAlarm | The number of datapoints that must be breaching to trigger the alarm. |
Dimensions | The dimensions for the metric associated with the alarm. |
EvaluateLowSampleCountPercentile | Used only for alarms based on percentiles. |
EvaluationPeriods | The number of periods over which data is compared to the specified threshold. |
ExtendedStatistic | The percentile statistic for the metric associated with the alarm. |
InsufficientDataActions | The actions to execute when this alarm transitions to the |
MetricName | The name of the metric associated with the alarm. |
Metrics | An array that enables you to create an alarm based on the result of a metric math expression. |
Namespace | The namespace of the metric associated with the alarm. |
OkActions | The actions to execute when this alarm transitions to the |
Period | The period, in seconds, over which the statistic is applied. |
Statistic | The statistic for the metric associated with the alarm, other than percentile. |
Tags | A list of key-value pairs to associate with the alarm. |
Threshold | The value to compare with the specified statistic. |
ThresholdMetricId | In an alarm based on an anomaly detection model, this is the ID of the |
TreatMissingData | Sets how this alarm is to handle missing data points. |
Unit | The unit of the metric associated with the alarm. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnAlarm(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnAlarm(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnAlarm(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnAlarm(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnAlarm(Construct, String, ICfnAlarmProps)
public CfnAlarm(Construct scope, string id, ICfnAlarmProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnAlarmProps
Resource properties.
Properties
ActionsEnabled
Indicates whether actions should be executed during any changes to the alarm state.
public virtual object ActionsEnabled { get; set; }
Property Value
System.Object
AlarmActions
The list of actions to execute when this alarm transitions into an ALARM state from any other state.
public virtual string[] AlarmActions { get; set; }
Property Value
System.String[]
AlarmDescription
The description of the alarm.
public virtual string AlarmDescription { get; set; }
Property Value
System.String
AlarmName
The name of the alarm.
public virtual string AlarmName { get; set; }
Property Value
System.String
AttrArn
The ARN of the CloudWatch alarm, such as arn:aws:cloudwatch:us-west-2:123456789012:alarm:myCloudWatchAlarm-CPUAlarm-UXMMZK36R55Z
.
public virtual string AttrArn { get; }
Property Value
System.String
Remarks
CloudformationAttribute: Arn
CdkTagManager
Tag Manager which manages the tags for this resource.
public virtual TagManager CdkTagManager { get; }
Property Value
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
ComparisonOperator
The arithmetic operation to use when comparing the specified statistic and threshold.
public virtual string ComparisonOperator { get; set; }
Property Value
System.String
DatapointsToAlarm
The number of datapoints that must be breaching to trigger the alarm.
public virtual Nullable<double> DatapointsToAlarm { get; set; }
Property Value
System.Nullable<System.Double>
Dimensions
The dimensions for the metric associated with the alarm.
public virtual object Dimensions { get; set; }
Property Value
System.Object
EvaluateLowSampleCountPercentile
Used only for alarms based on percentiles.
public virtual string EvaluateLowSampleCountPercentile { get; set; }
Property Value
System.String
EvaluationPeriods
The number of periods over which data is compared to the specified threshold.
public virtual double EvaluationPeriods { get; set; }
Property Value
System.Double
ExtendedStatistic
The percentile statistic for the metric associated with the alarm.
public virtual string ExtendedStatistic { get; set; }
Property Value
System.String
Remarks
Specify a value between p0.0 and p100.
InsufficientDataActions
The actions to execute when this alarm transitions to the INSUFFICIENT_DATA
state from any other state.
public virtual string[] InsufficientDataActions { get; set; }
Property Value
System.String[]
MetricName
The name of the metric associated with the alarm.
public virtual string MetricName { get; set; }
Property Value
System.String
Metrics
An array that enables you to create an alarm based on the result of a metric math expression.
public virtual object Metrics { get; set; }
Property Value
System.Object
Namespace
The namespace of the metric associated with the alarm.
public virtual string Namespace { get; set; }
Property Value
System.String
OkActions
The actions to execute when this alarm transitions to the OK
state from any other state.
public virtual string[] OkActions { get; set; }
Property Value
System.String[]
Period
The period, in seconds, over which the statistic is applied.
public virtual Nullable<double> Period { get; set; }
Property Value
System.Nullable<System.Double>
Statistic
The statistic for the metric associated with the alarm, other than percentile.
public virtual string Statistic { get; set; }
Property Value
System.String
Remarks
For percentile statistics, use ExtendedStatistic
.
Tags
A list of key-value pairs to associate with the alarm.
public virtual ICfnTag[] Tags { get; set; }
Property Value
ICfnTag[]
Threshold
The value to compare with the specified statistic.
public virtual Nullable<double> Threshold { get; set; }
Property Value
System.Nullable<System.Double>
ThresholdMetricId
In an alarm based on an anomaly detection model, this is the ID of the ANOMALY_DETECTION_BAND
function used as the threshold for the alarm.
public virtual string ThresholdMetricId { get; set; }
Property Value
System.String
TreatMissingData
Sets how this alarm is to handle missing data points.
public virtual string TreatMissingData { get; set; }
Property Value
System.String
Unit
The unit of the metric associated with the alarm.
public virtual string Unit { get; set; }
Property Value
System.String
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>