I have a custom metric with many dimensions. Can I setup an alarm against the value of a dimension instead of the metric?
You can't. A metric is identified by a set of dimensions and a namesapce. If you change a dimension value, well then you've created a new metric. You can only alarm on metric datapoint values.
See CloudWatch Concepts for clarification.
Related
Plotted a cloudwatch custim metric using lambda in aws cloudwatch/ but sent wrong dimension. In api call by mistake i sent swapped values for values / dimension name. now i am getting lot of metrics with 0.896, 0.345 etc dimentions. how to delete the. It iss creating garbage in the metric list.see screenshot for details.
Dimension is part of metric's identity:
A dimension is a name/value pair that is part of the identity of a metric.
Since its not possible to delete any metrics, you can't remove/change dimensions of metrics already in the AWS. You have to wait till it expires after 15 months:
CloudWatch does not support metric deletion. Metrics expire based on the retention schedules described above.
For your case, you have to create new metrics with correct dimension and use that in your plots and alarms.
I am trying to create alarm in cloudwatch. I have a metric where I emit 1.0 for success and 0.0 for failure. The SUM statistic is supposed to me give all the successful request while SAMPLE COUNT should give all the requests(including failed one). I want to create an alarm where if SUM(metric)/SAMPLE COUNT(metric) <= threshold it alarms. I am not able to do the same using a single metric. The SAMPLE COUNT option does not show up. Am I expected to create two metrics in order to achieve this in cloudwatch if it is not possible via single metric?
SUM(metric)/SAMPLE COUNT(metric) is the definition of average. Can you use the Average statistic?
Looking to list all EC2 servers/instances which have crossed a certain threshold using AWS CloudWatch
I want to view all my ec2 instances or servers which have reached or crossed some threshold i.e triggered some alarm, in any time in the last one month. I have been looking for a solution for the past two days but to no avail. I would really appreciate any help regarding the matter.
You can create an alarm in CloudWatch for an EC2 metric (e.g., CPUUtilization) for all instances by selecting a metric like this EC2 -> Across All Instances -> CPUUtilization. Then you can select a value for Statistic (e.g., Maximum) and a specify a period over which you need the alarm to check for alert (e.g., 1 Minute). Under conditions, select Threshold type (e.g., Static), chose the condition operator (e.g., Greater > threshold), define the threshold value (e.g., 75.0). Under Notification, select the value for Whenever this alarm state is (e.g., in Alarm) and Select an SNS topic. Finally, specify other values like name, description, etc and create the alarm.
Can you set up CloudWatch to fire an event (which can lead to a Lambda function being called) on every change to a metric? I can see how to fire an even when it meets a boundary via alerts, but I'd like an event on every change.
No.
A CloudWatch Alarm is triggered when a calculated metric goes outside a given bound over a desired time period. It is always a calculated value (eg average, sum, min, max) and is not based upon an individual metric.
That said, if you have very sparse metrics (that don't trigger very often), using COUNT or SUM might be sufficient but it isn't specifically what you are requesting.
If you have a metric that behaves in a predictable way then you can indeed achieve this kind of behaviour.
If you have a metric with a small set of possible values, for example, consider a metric where the value can be 0 or 1.
You could then create a CloudWatch alarm where the threshold is 0 for 1 period and then a second alarm where the threshold is 1 for 1 period.
So basically for each possible value that your metric can be, you would have an alarm. Each of these alarms would trigger an action of your choice e.g. SNS
As I said, this would only work if you have a metric with a known set of possible values, not with a metric that can have unpredictable values.
I am trying to create an alarm for "FreeStorageSpace" metric and units it takes is Bytes. What, however, I am trying to do is create an alarm using percentages (send an alarm is FreeStorageSpace < 10%) and not hardcode values. How can I create a CFT for that and reuse it for instances having different storage values.
Any help is appreciated.
Thanks
You can not use % value while creating the FreeStorageSpace alarm in CloudWatch. Also, the alarms in AWS are on per instance basis. You can not create a generic alarm for multiple instances. Hence, you may use numeric value for defining the alarm.