I'm attempting to the do the following:
I have a DynamoDB global table which publishes the ReplicationLatency metric. I want to create an alarm on the aggregate of the ReplicationLatency metric published for each region.
The DDB table replicas exist in us-east-1, us-west-2 and us-west-1. In defining the CW alarm for each receiving region, I was under the assumption that I could a search expression. For example, here's the expression I see in the CloudWatch console.
SEARCH('{AWS/DynamoDB,ReceivingRegion,TableName} MetricName="ReplicationLatency"', 'Average', 300)
I'd like to create a metric math alarm which is the avg of the metrics of the above search result. I was attempting to create a metric math expression of the format:
AVG(METRICS())
I then get the following error - The expression for an alarm must include at least one metric. Has anybody attempted to create an alarm from a search expression before? If yes, could you shed some light on how it can be done?
The only other way I can think of solving this problem is to enumerate/add the ReplicationLatency metric for each receiving region and then create a metric math expression out of that. That's seems to completely defeat the purpose of having a search expression and creating an alarm from all those metrics.
You cannot do alarms on search expressions at the moment.
You will have to add manually all the metrics you want to alarm on and then use the math function you specified above.
edit: official documentation link
Here is the link to official documentation:
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create-alarm-on-metric-math-expression.html
"You can't create an alarm based on the SEARCH expression. This is because search expressions return multiple time series, and an alarm based on a math expression can watch only one time series."
Related
I'm trying to combine certain number of similar metrics into a single alarm in aws cloud watch. For example lets say for data quality monitoring in sagemaker, one among the metrics that are emitted from data quality monitoring job is feature baseline drift distance for each column so let say I've 600 columns so each column will have this metric. Is there a possible way to compress these metrics into a single cloud watch alarm ?
If not, Is there anyway to send the violation report as message via AWS SNS?
While I am not sure exactly on what out come you want when you refer to "compress the metrics into a single alarm." You can look at using metric math
I'm trying to identify the initial creation date of a metric on CloudWatch using the AWS CLI but don't see any way of doing so in the documentation. I can kind of identify the start date if there is a large block of missing data but that doesn't work for metrics that have large gaps in data.
CloudWatch metrics are "created" with the first PutMetricData call that includes the metric. I use quotes around created, because the metric doesn't have an independent existence, it's simply an entry in the time-series database. If there's a gap in time with no entries, the metric effectively does not exist for that gap.
Another caveat to CloudWatch metrics is that they only have a lifetime of 455 days, and individual metric values are aggregated as they age (see specifics at link).
All of which begs the question: what's the real problem that you're trying to solve.
I am currently in the process of migrating some services to AWS and have hit a bit of a road block. I would like to be able to monitor the error percentage of a Lambda and create an Alarm if a certain threshold is breached. Currently the percentage error rate can be calculated with Metric Math, however alarms cannot be generated from this.
I was wondering if anyone know a way in that I could push the metrics require to calculate the percentage, Error and Invocation, to a Lambda and have the Lambda perform the calculation and create the SNS alarm?
Thanks!
CloudWatch just released the Alarms on MetricMath expressions.
https://aws.amazon.com/about-aws/whats-new/2018/11/amazon-cloudwatch-launches-ability-to-add-alarms-on-metric-math-expressions/
So basically you just need to:
Go to CloudWatch
Go to Alarms
Create Alarm
Add your metrics
Add a MetricMath expression
Optionally, add other properties for the alarm
Add the actions that you want to be executed
More information in their documentation
I have microservice that sends some custom metrics to AWS CloudWatch. Metric name consists of package name and some other data. For example gauge.com.example.test.time and gauge.com.example.test2.time and so on
Now I need to create some alarms based on this metrics. Is it possible to specify some reqular expression in metric name field when you create CloudWatch alarm instead of manual creation of separate alarm for each metric?
I tried such things: gauge.com.example..time gauge.com.example.*.time gauge.com.example.(\w).time and many other things but without success.
It is now possible to create aws alarms based on a Metric Math Expression.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Create-alarm-on-metric-math-expression.html
Not possible. From Creating Amazon CloudWatch Alarms
You can create a CloudWatch alarm that watches a single metric.
I'm trying to push data into a custom metric on AWS CloudWatch but wanted to find out more about the Dimensions and how these are used? I've already read the AWS documentation but it doesn't really explain what they are used for and how it affects the graphing UI in the AWS Management Console.
Are Dimensions a way to breakdown the Metric Value further?
To give a fictitious example, say I have a metric which counts the number of people in a room. The metric's name is called "Population". I report the count once a minute. The Metric Count is set to the number of people. The Dimension field is just a list of Name and Value pairs. Assuming I report a datapoint with a value of 90, can I add two Dimensions as follows:
1. Name: Male, Count: 50
2. Name: Female, Count: 40
Any help will be greatly appreciated.
Yes, you can add dimensions such as you described to your custom metrics.
However, CloudWatch is NOT able to aggregate across these dimensions, as it doesn't know the groups of these dimensions. Basically:
Amazon CloudWatch treats each unique combination of dimensions as a
separate metric. For example, each call to mon-put-data in the
following figure creates a separate metric because each call uses a
different set of dimensions. This is true even though all four calls
use the same metric name (ServerStats).
See more information about dimensions in CloudWatch here
Do note that you can retrieve aggregated value from API, as well as plot a graph in CloudWatch using a math expression. See Using metric math
I should probably also add that you can NOT use metric math in alarms.
update: as #Brooks said Amazon CloudWatch Launches Ability to Add Alarms on Metric Math Expressions
All in all pretty restricted and user-unfriendly compared e.g. to DataDog.