Create alarms

Create Alarms for Known Issues from Metrics

Monitoring for Application Outcomes Ryn Brandish wants to understand when there are application issue and is concerned about security. He would like metrics for errors and warnings. ExampleCorp has limitations on the image size that it can successfully process. While this issue does not happen frequently it does not make customers happy. Being aware of the error rate for submitted images will allow the Business and Development team to determine if increase the image size should be a priority. Currently most warnings are related to security issues. Ryn would like visibility on how often they happen.

5.1 Create a log filter metric based on the defined threshold for the error

  1. Click on Log Groups in the breadcrumb trail at the top of the screen
  2. Select the application.log group by clicking on the radio button next to it, and then in the Actions list choose Create Metric Filter.
  3. Enter “ActiveStorage::InvariableError” (include quotes) for Filter Pattern. This is a known error that we will cause later in the lab.
  4. Click on Next
  5. For Filter name, type ActiveStorage-InvariableError
  6. On Metric namespace list, select ApplicationLogMetrics
  7. Enter ImageError as the Metric Name
  8. Enter 1 as the Metric Value
  9. Click on Next
  10. Review the filter, and then click Create Metric Filter Image Error Metric

5.2 Create an alarm for the error when the metric threshold is crossed

  1. Select the ActiveStorage-InvariableError by clicking on the radio button next to it, and then choose Create alarm. Edit Metric
  2. Change Period to 10 seconds
  3. Under Conditions
    • Choose Static for threshold type
    • For Alarm condition, Choose Greater/Equal than 1
    • Under Additional Configuration, leave 1 out of 1 for datapoints to alarm
    • Select Treat missing data as good (not breaching threshold) for Treat missing data as Create Alarm
  4. Under Notification
    • Select In alarm for Alarm state trigger
    • Choose Select an existing SNS topic for Select an SNS topic
    • In the send a notification to…, choose the SNS topic that you created
  5. Click Next
  6. ImageErrorAlarm for Name
  7. Click Next
  8. Review the alarm, and click Create Alarm

NOTE: You should see that the alarm has insufficient data with a 1 next to INSUFFICIENT in the navigation menu. This will change to OK within a few seconds.

5.3 Generate error logs through user activity

  1. Navigate to the ExampleCorp using the URL that you made a note of earlier (CloudFormation Output).
  2. Enter admin@admin.com for email
  3. Enter Password123 for Password
  4. Click Login
  5. Click Upload Image Click Select Image
  6. Find break_app.jpg in your filesystem
  7. Click Upload

NOTE: The application will start exhibiting issues, and the application will eventually fail to load.

5.4 Review logs to identify error

  1. Navigate to the CloudWatch Console
  2. Click Logs in the navigation menu
  3. Click on application.log log group - this is from /opt/ExampleCorp/log/application.log as configured earlier in the CloudWatch agent configuration.
  4. Click on the Search Log Group button
  5. Enter ERROR (case sensitive) and hit enter.
  6. You will see errors ending ActiveStorage::InvariableError. This is an error that is generated when a user uploads a non-image file. This is a known issue, but the Dev team has not had cycles to adress it.

Build a Monitoring Plan: Alerting and Response

Monitoring for Operational Outcomes Sansa Bailish is focused on outages, reliability, and getting better sleep. There is a known issue with image trends; when the instances are rebooted the application doesn’t restart. Too frequently Sansa has received a late night call to get online and restart the application. The user experience lead is very frustrated with the downtime associated to these incidents. They need to be detected sooner and resolved faster.

Sansa is looking for a monitoring solution to detect the incident (the reboot event), and a way to trigger an automated recovery.