Amazon CloudWatch is an AWS service for monitoring AWS resources and the customer applications running on the AWS infrastructure.
![](https://github.com/xmatters/xMatters-Labs/raw/master/media/disclaimer.png)
An updated version of this integration is available. You can install the new version right from the Workflow Templates directory within your xMatters instance. Learn more.
- AWSCloudWatch.zip - The Workflow containing the forms and flow canvas
When a CloudWatch Alarm condition is met, an Amazon Simple Notification Service (SNS) message is published and picked up by the SNS subscription. The subscription is tied to a Topic, which generates a webhook to the xMatters inbound integration.
The next step is to import the communication plan.
To import the communication plan:
- Login to xMatters as a Developer and create a new user.
- Create a new REST user. See details here
- Import the AWSCloudWatch.zip communications plan.
- Next to the AWS - CloudWatch workflow, click Edit > Editor Permissions and give access to the user created in step 2.
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/editor_permissions.png)
- Click on the AWS - CloudWatch workflow and next to the Cloudwatch Alarm, click Web Service > Sender Permissions and give access to the user created in step 2. Repeat for the Subscription Confirmation form.
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/sender_permissions.png)
- Click Edit > Layout next to the Subscription Confirmation form. Enter your username in the Recipients section. (This will be used later to receive the subscription confirmation url.)
- Navigate to the Flows tab and click on the CloudWatch Alarm flow. After the canvas is displayed, double click on the CloudWatch Alarm - Inbound SNS step and copy the URL at the bottom:
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/flowTrigger.png)
- Click on the Amazon Simple Notification Service
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/awsSNS.png)
- Create a topic
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/awsTopic.png)
- Create a Subscription.
Note: If you would like to override the default recipients defined in the Form Layout in step 6 above, append
&recipients=MyAWESOMEGroup
. For example, if this is the HTTP Trigger url:
https://acme.xmatters.com/api/integration/1/functions/23cba8b4-a7c2-91d2-ab15-82db3f9a35a7/triggers?apiKey=aebd0bdc-c918-4a51-8984-82db3f9a35a7
Then append the &recipients
to make it look like so:
https://acme.xmatters.com/api/integration/1/functions/23cba8b4-a7c2-91d2-ab15-82db3f9a35a7/triggers?apiKey=aebd0bdc-c918-4a51-8984-82db3f9a35a7&recipients=MyAWESOMEGroup
This recipients value will be parsed from the parameters and used as the target for both the confirmation event as well as alarm events. Update this value to map different subscriptions to different groups.
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/snsSubscription.png)
- Make sure the endpoint protocol is https
- Select the appropriate ARN from the drop down.
- In the endpoint field, use the url copied from the Inbound from SNS HTTP Trigger in the Flow Designer above.
- Once the subscription is saved, a confirmation will be fired, however, if you don't see an email, the confirmation can be re-triggered by selecting the subscription and clicking the Request Confirmation.
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/snsSubscriptionConf.png)
- You will receive a new email from xMatters with the Subscription Confirmation URL
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/snsSubscriptionConf2.png)
- Click the Subscription URL link and an XML file will be displayed:
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/snsSubscriptionConf3.png)
And the subscription will show a subscription ARN instead of the PendingConfirmation
and the Status will be updated. The page may need to be refreshed to see the updated status.
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/snsSubscriptionConf4.png)
- Go back to the CloudWatch Console
- Click on Alarm
- Click on Create Alarm
- Give the alarm a good name and descriptive description
- Set the "Whenever" information to the criteria you need to monitor. For example,
CPUUtilization > 0.9 for 4 out of 5 datapoints
. - Whenever this alarm state is:
in Alarm
- Send notification to
Send_to_XM
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/alarm.png)
- Save the alarm.
- From the Alarms page, click on your newly created alarm, then click Edit.
- Click Next at the bottom of the Specify metric and conditions page.
- Click Add Notification and select Whenever this alarm state is:
in Alarm
- select an existing SNS topic and select
Send_to_XM
. - Click Update alarm to save the changes:
![](/xmatters/xm-labs-AWScloudwatch/raw/master/media/alarm-ok.png)
Spike the CPU on an ec2 instance, or otherwise trigger the criteria in the Whenever
section of the alarm. Then, check the Activity Stream in the Inbound from SNS inbound integration. There should be a new entry and a resulting event generated, targeting the recipients set in the form.
The first place to check is the Activity Stream in the CloudWatch Alarm flow canvas. If there is no entry here, the SNS topic failed to fire so investigate the Whenever
condition and verify the condition was triggered and verify the SNS topic is correctly set up. If there is an entry in the activity stream, but no event, the investigate the activity stream for more details. There will be an error message on why the event wasn't generated.
If the event was generated but no notification was received, check the recent events report for the event generated to see who was notified. Then verify the correct recipients.