Name: aws-xray-cloudwatch-event
Owner: AWS Samples
Description: Sample using Amazon CloudWatch Events and Alarms to notify AWS X-Ray users when their services have elevated levels of latency, errors and faults.
Created: 2017-11-12 20:09:01.0
Updated: 2017-12-19 19:00:06.0
Pushed: 2017-12-08 05:00:11.0
Homepage: null
Size: 179
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
This sample application is licensed under the Apache 2.0 License.
This sample app will help you setup SMS and email alerts when services in your application have elevated latency, or error and fault rates.
This sample app uses AWS X-Ray, Amazon CloudWatch, AWS Lambda and Amazon SNS. You will be charged based on pricing for each of these individual services. Please refer to the overview section above to understand the architecture of this app and the resources it'll create. The pricing information for the services used in this application is as follows:
AWS X-Ray: https://aws.amazon.com/xray/pricing/ Amazon CloudWatch: https://aws.amazon.com/cloudwatch/pricing/ AWS Lambda: https://aws.amazon.com/lambda/pricing/ Amazon SNS: https://aws.amazon.com/sns/pricing/
The sample app requires the following information to successfully notify you. Please note that your AWS account will be charged by Amazon SNS for these notifications beyond the free tier. For Amazon SNS pricing information please visit: https://aws.amazon.com/sns/pricing/
rts":
"default":
{
"responseunitthreshold":<type: integer. Value representing minutes>,
"errorpercentagethreshold":<type: float. Value between 0 and 1>,
"faultpercentagethreshold":<type: float. Value between 0 and 1>,
"throttlepercentagethreshold":<type: float. Value between 0 and 1>
}
lyzeservicemapminutes":<type: integer. The schedule (in minutes) that determines when CloudWatch Events triggers the Lambda function and time duration for analyzing the X-Ray service map>,
luationperiodforcwalarm":<type: integer. The evaluation period for your CloudWatch alarm>,
munications":
"sms":
[
"type:Phone number (without dashes) with country and area code. Format: 19876543210",
"type:Phone number (without dashes) with country and area code. Format: 19876543210"
],
"email":
[
"type: email. Format: abcd@efgh.com",
"type: email. Format: abcd@efgh.com"
]
}
optional) If you would like to only get notified for specific services in your application, you can add individual service sections:
“alerts”:
{
<service_name_1>":
{
"responseminutesthreshold":<type: integer. Value representing minutes>,
"errorpercentagethreshold":<type: float. Value between 0 and 1>,
"faultpercentagethreshold":<type: float. Value between 0 and 1>,
"throttlepercentagethreshold":<type: float. Value between 0 and 1>,
"type":<type: string. The type of the node that is shown in your X-Ray service map console>
},
<service_name_2>":
{
"responseminutesthreshold":<type: integer. Value representing minutes>,
"errorpercentagethreshold":<type: float. Value between 0 and 1>,
"faultpercentagethreshold":<type: float. Value between 0 and 1>,
"throttlepercentagethreshold":<type: float. Value between 0 and 1>,
"type":<type: string. The type of the node that is shown in your X-Ray service map console>
}
}
b. Install the sample app
CloudFormation template will create the required resources such as S3 buckets, CloudWatch events, CloudWatch rules, IAM roles and Lambda function. Note: You have to update xraycloudwatchevent.json as described above prior to installing the sample app.
it clone this repository.
o to Setup/ directory.
cd Setup/
un install.py script
python install.py
rovide your sample app name and region when requested by the install.py script.
c. Uninstall the sample app
stalling the sample app is easy as well. It removes any relevant S3 bucket and resources created by CloudFormation for this app.
o to Setup/ directory.
cd Setup/
un uninstall.py script
python uninstall.py
rovide your sample app name and region when requested by the uninstall.py script.
sing the sample app
he sample app is an AWS Lambda function, which is triggered by a CloudWatch event at the scheduled time defined by you.
his sample app analyzes your AWS X-Ray service graph, aggregated at the provided time window and sends out a CloudWatch event in case the latency, error or fault rates breach the threshold. You can define a custom threshold using the xraycloudwatch.json file.
n matching the pattern defined in the CloudWatch Rule, the CloudWatch Event will invoke the SNS topic to send a SMS message to the provided phone number.
he CloudWatch Alarm will be trigerred if TriggeredRules > 0 in the evaluation period, which is also defined in the xraycloudwatch.json file, to invoke another SNS topic that sends out an email.