简体   繁体   English

当来自AWS API Gateway的API超时或出现错误时发送Slack警报

[英]Send Slack Alerts when APIs from AWS API Gateway gets Timeout or gives Error

We have used API Gateway for routing our actual apis which are written in loopback . 我们已经使用API​​ Gateway路由以loopback形式编写的实际api。

I have come across that API Gateway has default timeout of 29 seconds. 我发现API网关的默认超时为29秒。

Our server is in production now, some apis are taking too much time, some giving errors and some are not working only. 我们的服务器现在已经投入生产,一些api占用了太多时间,一些api给出了错误,有些api不能正常工作。

So it is difficult to manager exactly which APIs are causing the issue. 因此,很难准确地管理导致问题的API。

I am looking for an automated solution, like Is it possible to detect APIs Timeout or errors, In API Gateway via some lambda function or cloud watch alerts. 我正在寻找一种自动化解决方案,例如是否可以通过一些lambda函数或cloud watch警报在API网关中检测API超时或错误。

Note that I want to send notification of the APIs that are getting timeout or causing error not all the apis. 请注意,我要发送不是所有API都超时或导致错误的API的通知。

Thanks 谢谢

There is no direct integration with Slack from CloudWatch. 没有与CloudWatch的Slack直接集成。 Here is the architecture we follow. 这是我们遵循的架构。

Cloudwatch --> SNS --> Lambda --> Slack Cloudwatch-> SNS-> Lambda->松弛

Send your alarms to SNS and subscribe to Lambda, then lambda can send it to slack. 将您的警报发送到SNS并订阅Lambda,然后lambda可以将其发送到备用服务器。 You can keep the slack generic for any alerts you receive from cloudwatch. 对于从Cloudwatch收到的任何警报,您都可以保留松弛常规。

Also with Slack you can control delivering to multiple channels for different type of alerts. 同样,使用Slack,您可以控制将不同类型的警报传递到多个渠道。

The complete above implementation is documented here, should not take more than 10 minutes to complete everything. 上面记录了完整的上述实现,完成所有过程的时间不应超过10分钟。

https://read.acloud.guru/slack-notification-with-cloudwatch-alarms-lambda-6f2cc77b463a https://read.acloud.guru/slack-notification-with-cloudwatch-alarms-lambda-6f2cc77b463a

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM