ccl*_*eve 18 amazon-web-services amazon-cloudwatch
我在AWS上运行了一个应用程序.如何设置Amazon CloudWatch以在EC2实例失败或不再响应时通知我?
我浏览了CloudWatch屏幕,看起来你可以监控某些统计信息,比如CPU或磁盘利用率,但我没有看到监控事件的方法,例如"实例获得了一个http请求并花费了超过X秒的时间响应."
sor*_*han 13
To monitor an event in CloudWatch you create an Alarm, which monitors a metric against a given threshold.
When creating an alarm you can add an "action" for sending a notification. AWS handles notifications through SNS (Simple Notification Service). You can subscribe to a notification topic and then you'll receive an email for you alarm.
For EC2 metrics like CPU or disk utilization this is the guide from the AWS docs: http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/US_AlarmAtThresholdEC2.html
As answered already, use an ELB to monitor HTTP.
This is the list of available metrics for ELB: http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/US_MonitoringLoadBalancerWithCW.html#available_metrics
To answer your specific question, for monitoring X seconds for the http response, you would set up an alarm to monitor the ELB "Latency".
Ste*_*rno 13
亚马逊的Route 53 Health Check是适合这项工作的正确工具.
Route 53可以监控应用程序以及Web服务器和其他资源的运行状况和性能.
您可以在Route 53中设置HTTP资源检查,如果服务器关闭或响应错误,将触发电子邮件通知.
http://eladnava.com/monitoring-http-health-email-alerts-aws/
CloudWatch监控就像您发现的一样.您可以通过查看指标来推断您的某个实例被冻结,但CloudWatch不会例如在您的应用程序停机或太慢时向您发送电子邮件.
如果您在应用或实例关闭时寻找某种通知,我建议您使用监控服务.Pingdom是一个不错的选择.您还可以在AWS上设置新实例并安装监控工具,如Nagios,这将是我的首选选项.
在漫长的道路上总是值得的良好实践:使用负载平衡(Amazon ELB),运行应用程序的多个实例,Autoscaling(当实例关闭时,Amazon将自动启动新的并保持您的SLA),以及自定义监控.
我的团队已经使用了一个自定义监控脚本很长一段时间,我们一旦发生故障就会立即知道它们.基本上,如果我们有两个节点运行我们的应用程序,节点1将HTTP请求发送到节点2,节点2发送到1.如果任何请求超过预期,或返回意外的HTTP状态或响应正文,脚本会向系统管理员.如今,我们依赖于更强大的方法,如Nagios,它甚至可以监视操作系统的东西(线程等),应用程序服务器(连接池的健康状况等)等等.值得每一分钱投入设置它.
小智 5
CloudWatch最近添加了"状态检查"指标,这些指标将回答您关于实例是否已关闭的一个问题.它不会向您的Web服务器发出请求,而是进行系统检查.如前面的答案所示,使用ELB进行HTTP运行状况检查.
| 归档时间: |
|
| 查看次数: |
24644 次 |
| 最近记录: |