CloudWatch Alarm to Monitor Daily Job


We have a legacy cron job which is expected to run on a daily basis, the only metric the job is publishing is Time metric.


We want to monitor 1 thing for this job:

  1. It indeed runs on a daily basis, if dp is missing in a day, then alarm


For this cron job, I created a alarm as:

Period: 1 day
Evaluation Period: 1 day
Datapoint to alarm: 1
TreatMissingData: BREACH

However I would get this validation error from CW:

Metrics cannot be checked across more than a day (EvaluationPeriods * Period must be <= 86400) 


If I set period to, say, 5min, then I have to set TreatMissingData: NOT_BREACH? as within 5min, there won't be a dp published by the job unless the job actually ran at the scheduled hour.

How should I set the correct alarm here? any suggestions?

asked a month ago158 views
1 Answer


As you know, the evaluation period for CloudWatch alarms cannot exceed one day.

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".

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.


# 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
  # If executed at a time other than 10:00
  aws cloudwatch put-metric-data --metric-name "metric_name" --namespace "namespace_name" --value 1
profile picture
answered a month ago
profile pictureAWS
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions