public static void CWDescribeAlarmsForMetric()
{
#region CWDescribeAlarmsForMetric
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 = client.DescribeAlarmsForMetric(request);
if (response.MetricAlarms.Count > 0)
{
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.");
}
#endregion
Console.ReadLine();
}