- Newest
- Most votes
- Most comments
Hello.
As you know, the evaluation period for CloudWatch alarms cannot exceed one day.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_limits.html
The maximum value, calculated by multiplying the alarm period by the number of evaluation periods used, is one day (86,400 seconds). This quota cannot be changed.
If you set it to "notBreaching", it may depend on how the metrics are registered, but even if no data is sent when cron execution fails, it may be determined to be normal.
If data is not sent to metrics when cron fails, I think it is necessary to set it to "breaching".
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html#alarms-and-missing-data
notBreaching – Missing data points are treated as "good" and within the threshold
How about setting the cron execution interval to every hour or so so that it does not perform any processing other than sending data to CloudWatch outside of a specific time?
For example, let's imagine creating a shell script like the one below.
The shell script below performs processing when executed at 10 am, and only sends data to CloudWatch metrics at other times.
#!/bin/bash
# now time
current_hour=$(date +%H)
if [ "$current_hour" -eq 10 ]; then
# example command
echo "example command"
aws cloudwatch put-metric-data --metric-name "metric_name" --namespace "namespace_name" --value 1
else
# If executed at a time other than 10:00
aws cloudwatch put-metric-data --metric-name "metric_name" --namespace "namespace_name" --value 1
fi
Relevant content
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated 2 days ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 months ago
- How can I monitor daily EstimatedCharges and trigger a CloudWatch alarm based on my usage threshold?AWS OFFICIALUpdated 2 years ago