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.
Container for the parameters to the DescribeAlarmsForMetric operation. 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.
Namespace: Amazon.CloudWatch.Model
Assembly: AWSSDK.CloudWatch.dll
Version: 3.x.y.z
public class DescribeAlarmsForMetricRequest : AmazonCloudWatchRequest IAmazonWebServiceRequest
The DescribeAlarmsForMetricRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
DescribeAlarmsForMetricRequest() |
Name | Type | Description | |
---|---|---|---|
![]() |
Dimensions | System.Collections.Generic.List<Amazon.CloudWatch.Model.Dimension> |
Gets and sets the property Dimensions. The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed. Starting with version 4 of the SDK this property will default to null. If no data for this property is returned from the service the property will also be null. This was changed to improve performance and allow the SDK and caller to distinguish between a property not set or a property being empty to clear out a value. To retain the previous SDK behavior set the AWSConfigs.InitializeCollections static property to true. |
![]() |
ExtendedStatistic | System.String |
Gets and sets the property ExtendedStatistic. The percentile statistic for the metric. Specify a value between p0.0 and p100. |
![]() |
MetricName | System.String |
Gets and sets the property MetricName. The name of the metric. |
![]() |
Namespace | System.String |
Gets and sets the property Namespace. The namespace of the metric. |
![]() |
Period | System.Nullable<System.Int32> |
Gets and sets the property Period. The period, in seconds, over which the statistic is applied. |
![]() |
Statistic | Amazon.CloudWatch.Statistic |
Gets and sets the property Statistic.
The statistic for the metric, other than percentiles. For percentile statistics, use
|
![]() |
Unit | Amazon.CloudWatch.StandardUnit |
Gets and sets the property Unit. The unit for the metric. |
This example shows how to get information about all alarms for a metric.
var client = new AmazonCloudWatchClient(); var dimension = new Dimension { Name = "AutoScalingGroupName", Value = "awseb-e-kkbEXAMPLE-stack-AutoScalingGroup-F4TAUEXAMPLE" }; var request = new DescribeAlarmsForMetricRequest { Dimensions = new List<Dimension>() { dimension }, MetricName = "NetworkOut", Namespace = "AWS/EC2" }; var response = await client.DescribeAlarmsForMetricAsync(request); if (response.MetricAlarms != null) { foreach (var alarm in response.MetricAlarms) { Console.WriteLine(); Console.WriteLine(alarm.AlarmName); Console.WriteLine(alarm.AlarmDescription); Console.WriteLine(alarm.MetricName + " " + alarm.ComparisonOperator + " " + alarm.Threshold); } } else { Console.WriteLine("No alarms."); }
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.7.2 and newer