You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Is there a way to mimic a CloudWatch SNS notification when creating an alert so that it will be picked up by the CloudWatch API integration instead of the Default API?
I've tried posting SNSEvent JSON payloads and CloudWatch JSON payloads to both my Alerts API with Geniekey and my alerts https endpoint.
The server returns error 422 Unprocessable Entity.
Creating custom alerts otherwise works fine using the parameters listed in the Alerts API
CloudWatch JSON example:
Hi @Joel Bradley !
What you could do is take that payload that SNS is sending to Opsgenie, and make an API request to your Cloudwatch integration endpoint in Opsgenie
You will want to ensure the payload you are sending in the POST request is in the same format that our Cloudwatch integration is expecting. An example of this payload is shown on our doc here. So you can take that payload, and just make a POST API request to the endpoint provided in your Cloudwatch integration in Opsgenie.
Hope that helps!
Thanks,
Samir
Hi Samir,
Thanks for your reply.
I tried POSTing the sample payload from the link you provided both with and without escaped quotation marks to my Cloudwatch API endpoint. The server still returns error 422. Unfortunately it doesn't say which character tripped the serializer up.
I've had problems with some serializers being unable to handle the nested objects inside a Cloudwatch payload.
Sample Cloudwatch JSON payload with escape sequences:
{ "Type": "Notification", "MessageId": "1cf7a0eb-4179-4181-b15b-ea22c5aa0280", "TopicArn": "arn:aws:sns:us-east-1:08931xxxxxx:CloudWatchHTTPAlarms", "Subject": "ALARM: \"cpuUtilTest\" in US - N. Virginia", "Message": "{\"AlarmName\":\"cpuUtilTest\",\"AlarmDescription\":\"testing alarms for cpu utilization\",\"AWSAccountId\":\"08931xxxxxx\",\"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+ofOl1ZxxxxxxxxlimTUg+rV4U9RmNSSBEdlmyWvtGgpjebsmNv1wkjUsBQOJZjZnpZp5FBn6quAn3twNdRMmMLf15lv6ESbYFxxxxxxxx0vmjj/ZLwiH9Pr/cxVYxxxxxxxYn8w6g=", "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c72xxxxxxxxx6de52f.pem", "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:08931xxxxxxxx:CloudWatchHTTPAlarms:1841c5ca-ddda-450e-bbfb-xxxxxxxxx" }
Sample Cloudwatch JSON payload without escape sequences:
{
"Type": "Notification",
"MessageId": "1cf7a0eb-4179-4181-b15b-ea22c5aa0280",
"TopicArn": "arn:aws:sns:us-east-1:08931xxxxxx:CloudWatchHTTPAlarms",
"Subject": "ALARM: "cpuUtilTest" in US - N. Virginia",
"Message": "{"AlarmName":"cpuUtilTest","AlarmDescription":"testing alarms for cpu utilization","AWSAccountId":"08931xxxxxx","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+ofOl1ZxxxxxxxxlimTUg+rV4U9RmNSSBEdlmyWvtGgpjebsmNv1wkjUsBQOJZjZnpZp5FBn6quAn3twNdRMmMLf15lv6ESbYFxxxxxxxx0vmjj/ZLwiH9Pr/cxVYxxxxxxxYn8w6g=",
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c72xxxxxxxxx6de52f.pem",
"UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:08931xxxxxxxx:CloudWatchHTTPAlarms:1841c5ca-ddda-450e-bbfb-xxxxxxxxx"
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Joel Bradley ,
You need to include the following 2 Headers as well...
Content-Type: text/plain; charset=UTF-8
x-amz-sns-message-type: Notification
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.