Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Amazon CloudWatch Integration

Amazon CloudWatch provides monitoring for Amazon Web Services (AWS) and the applications that run on AWS. CloudWatch metrics play a critical role in the monitoring of the applications running on AWS cloud. A CloudWatch alarm can watch a single metric over a specified time period and execute automated actions based on the value of the watched metric and given threshold.

What does OpsGenie offer to CloudWatch users?

AWS CloudWatch triggers user defined alarms by watching metrics. OpsGenie acts as a dispatcher for these alarms, determining the right people to notify based on on-call schedules, notifying them using email, text messages (SMS), phone calls and iPhone & Android push notifications, and escalating alerts until the alert is acknowledged or closed. Simply, CloudWatch detects problems, and OpsGenie ensures the right people are working on the them.

Functionality of the integration

  • When an alert is created in CloudWatch, an alert is created in OpsGenie automatically through the integration.
  • When alert is closed in CloudWatch, related alert is closed in OpsGenie automatically through the integration.

Add CloudWatch Integration in OpsGenie

  1. Please create an OpsGenie account if you haven't done so already.
  2. Go to OpsGenie's Cloudwatch Integration page.
  3. Specify who should be notified for CloudWatch alerts using the "Teams" field. Autocomplete suggestions will be provided as you type.
  4. Copy the integration URL by clicking on the copy button or selecting. URL includes OpsGenie endpoint as well as the API key.
  5. Click on "Save Integration"

Setup Alarms on CloudWatch

  1. Create an SNS topic with name OpsGenie
  1. Add an HTTPS subscription to your topic with the OpsGenie API endpoint by using the url provided from OpsGenie Integration

https://api.opsgenie.com/v1/json/cloudwatch?apiKey=integrationApiKey

Upon successfully configuring SNS substription to OpsGenie a confirmation alert will be created on OpsGenie :

  1. Create a CloudWatch alarm with any metric and select the SNS topic you’ve created as the action

Make sure your Alarm Name on CloudWatch includes your resource name and metric name for uniqueness and ease of readability : Sample : SQS Queue chat_webhook messageCount Too High
Make sure that you send notifications for all of the states ALARM, OK and INSUFFICIENT to OpsGenie. Notifications with state ALARM will create alerts and notifications with states OK and INSUFFICIENT will close the matching alerts by default.

By Default OpsGenie Integration creates alias for each alert by using Region - AlarmName, this way OpsGenie uniquely identifies each CloudWatch alarm , creates and closes them respectively.

Test Alerts

  1. After setting up Notifications for an alarm on CloudWatch, just for testing purpose you can modify the threshold of the alarm on CloudWatch, so that it creates an alarm
  2. When the alarm condition is met, AWS CloudWatch will pass alarm details to OpsGenie, and OpsGenie will notify the specified users (recipients parameter) based on the recipients’ notification preferences. The OpsGenie alert will contain all the relevant information provided by CloudWatch.
  1. Make sure you revert back your CloudWatch alarm threshold configuration after you completed your testing with CloudWatch.

Sample payload sent from Cloudwatch

Create Alert payload:

{
  "Type": "Notification",
  "MessageId": "1cf7a0eb-4179-4181-b15b-ea22c5aa0280",
  "TopicArn": "arn:aws:sns:us-east-1:089311581210:CloudWatchHTTPAlarms",
  "Subject": "ALARM: \"cpuUtilTest\" in US - N. Virginia",
  "Message": "{\"AlarmName\":\"cpuUtilTest\",\"AlarmDescription\":\"testing alarms for cpu utilization\",\"AWSAccountId\":\"089311581210\",\"NewStateValue\":\"ALARM\",\"OldStateValue\":\"OK\",\"NewStateReason\":\"Threshold Crossed: 1 datapoint (5.199) was greater than or equal to the threshold (5.0).\",\"StateChangeTime\":\"2012-08-05T22:31:25.524+0000\",\"Region\":\"US - N. Virginia\",\"Trigger\":{\"MetricName\":\"CPUUtilization\",\"Namespace\":\"AWS/EC2\",\"Statistic\":\"AVERAGE\",\"Unit\":null,\"Dimensions\":[{\"name\":\"InstanceId\",\"value\":\"i-39e64c5f\"}],\"Period\":900,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanOrEqualToThreshold\",\"Threshold\":5.0}}",
  "Timestamp": "2012-08-05T22:31:30.673Z",
  "SignatureVersion": "1",
  "Signature": "XrsO2wtE0b+ofOl1Z85tqLqQn1fMuv07uRttlimTUg+rV4U9RmNSSBEdlmyWvtGgpjebsmNv1wkjUsBQOJZjZnpZp5FBn6quAn3twNdRMmMLf15lv6ESbYF8mpFHwmMhgWVkgq60vmjj/ZLwiH9Pr/cxVYOR0aPQBPDwTYn8w6g=",
  "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
  "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:089311581210:CloudWatchHTTPAlarms:1841c5ca-ddda-450e-bbfb-bf0cf15813db"
}

This payload is parsed by OpsGenie as:

{
  "TopicArn": "arn:aws:sns:us-east-1:089311581210:CloudWatchHTTPAlarms",
  "AlarmName": "cpuUtilTest",
  "Subject": "ALARM: \"cpuUtilTest\" in US - N. Virginia",
  "AlarmDescription": "testing alarms for cpu utilization",
  "NewStateReason": "Threshold Crossed: 1 datapoint (5.199) was greater than or equal to the threshold (5.0).",
  "NewStateValue": "ALARM",
  "OldStateValue": "OK",
  "StateChangeTime": "2012-08-05T22:31:25.524+0000",
  "Region": "US - N. Virginia",
  "Trigger": {
    "MetricName": "CPUUtilization",
    "Namespace": "AWS/EC2",
    "Statistic": "AVERAGE",
    "Unit": null,
    "Dimensions": [
      {
        "name": "InstanceId",
        "value": "i-39e64c5f"
      }
    ],
    "Period": 900,
    "EvaluationPeriods": 1,
    "ComparisonOperator": "GreaterThanOrEqualToThreshold",
    "Threshold": 5
  }
}

Our AWS CloudWatch Integration was updated on December 8, 2015 to cover CloudWatch events with INSUFFICIENT state. After this update, by default, events with state ALARM result in creating alerts and events with states OK and INSUFFICIENT result in closing the matching alerts by default after this update. Therefore, please make sure that your CloudWatch events that are directed to OpsGenie also include the state INSUFFICIENT.

Besides, if you are using advanced settings for our AWS CloudWatch integration, you can setup the filtering condition rules as follows to make your AWS CloudWatch integration work as described above:

  • The filtering rule for Create Alert should be matched if NewStateValue is ALARM.
  • The filtering rule for Close Alert should be matched if *NewStateValue is not ALARM.

Amazon CloudWatch Integration