{"componentChunkName":"component---src-templates-best-practice-detail-tsx","path":"/best-practice/2021-12-15-eb","result":{"data":{"currentBlog":{"id":"36570569-7eef-52ad-a4ec-98de550dbd95","frontmatter":{"thumbnail":"https://qcloudimg.tencent-cloud.cn/raw/7e24e227c79d7f4fb2551093b1b9c40a.jpg","authors":["杜佳辰"],"categories":["best-practice"],"date":"2021-12-15T00:00:00.000Z","title":"EventBridge 最佳实践场景一：Oceanus 告警消息实时推送","description":"本文演示了如何捕获 Oceanus 集群状态变更，并发送到企业微信或钉钉、飞书客户端。","authorslink":null,"translators":null,"translatorslink":null,"tags":["Serverless","云函数"],"keywords":null,"outdated":null},"wordCount":{"words":142,"sentences":25,"paragraphs":25},"fileAbsolutePath":"/opt/build/repo/content/best-practice/2021-12-15-eb.md","fields":{"slug":"/best-practice/2021-12-15-eb/","keywords":["serverless","无服务器","云函数","推送","事件","告警","qq","docs","Oceanus","image"]},"html":"<h2 id=\"01-背景介绍\"><a href=\"#01-%E8%83%8C%E6%99%AF%E4%BB%8B%E7%BB%8D\" aria-label=\"01 背景介绍 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>01. 背景介绍</h2>\n<p>监控与报警系统对于业务生产环境来说是不可或缺的，一旦有故障发生，需要有完善的监控告警链路，保证告警消息可以实时完成推送并进行处理。</p>\n<p>腾讯云事件总线（EventBridge）是一款安全、稳定、高效的无服务器事件管理平台。事件中心的事件总线可以接收来自您自己的应用程序、软件即服务（SaaS）和腾讯云服务的实时事件及相关数据流，通过集成消息推送和 SCF 云函数，可以实现邮件、短信、企业微信、钉钉、飞书等多种方式的通知。</p>\n<p>流计算 Oceanus 是大数据产品生态体系的实时化分析利器，是基于 Apache Flink 构建的具备一站开发、无缝连接、亚秒延时、低廉成本、安全稳定等特点的企业级实时大数据分析平台。流计算 Oceanus 以实现企业数据价值最大化为目标，加速企业实时化数字化的建设进程。</p>\n<p>通过结合 EventBridge + 云函数 SCF，可以实时捕获 Oceanus 集群异常事件并完成推送，本文演示如何捕获 Oceanus 集群状态变更，并发送到企业微信或钉钉、飞书客户端。</p>\n<h2 id=\"02-架构设计\"><a href=\"#02-%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1\" aria-label=\"02 架构设计 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>02. 架构设计</h2>\n<p>整体架构设计如下图，从图中可以看出，当 Oceanus 发生状态变更时（如实例异常，实例隔离，实例下线等）， Oceanus 系统会产生告警事件并主动推送给 EB，经过 EB 绑定的告警规则筛选后，完成到指定目标的推送，并可以基于 SCF 云函数，推送给更多第三方服务。</p>\n<p><img src=\"https://docimg3.docs.qq.com/image/vsyhChdiJNejEIwcJkPRLA.png?w=1280&#x26;h=524.3586206896551\"></p>\n<h2 id=\"03-操作步骤\"><a href=\"#03-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A4\" aria-label=\"03 操作步骤 permalink\" class=\"anchor\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>03. 操作步骤</h2>\n<ol>\n<li>登录 <a href=\"https://console.cloud.tencent.com/eb\">EventBridge 控制台</a>，配置告警规则</li>\n</ol>\n<p><img src=\"https://docimg4.docs.qq.com/image/ywr6eYkK3QKT9DQhU74MCA.png?w=1280&#x26;h=388.3835616438356\"></p>\n<ol start=\"2\">\n<li>以「流计算 Oceanus TaskManager CPU 负载过高」事件告警配置为例，您可以选择指定的事件告警类型，也可以选择全部告警事件，详细事件匹配规则请参见 <a href=\"https://cloud.tencent.com/document/product/1359/56084\">管理事件规则</a></li>\n</ol>\n<p><img src=\"https://docimg3.docs.qq.com/image/g3YmgwjiG0QA32PYpqkFzw.png?w=1280&#x26;h=703.7578814627996\"></p>\n<ol start=\"3\">\n<li>配置推送目标</li>\n</ol>\n<p>可以自由选择投递目标，此处以消息推送和云函数两个投递目标为例</p>\n<ul>\n<li>消息推送：通过配置消息推送，将您的告警事件推送至指定的消息接收渠道，完成用户及时触达。</li>\n</ul>\n<p><img src=\"https://docimg9.docs.qq.com/image/yg7MTSTIlNUMg-Em4hI1Rw.png?w=1202&#x26;h=556\"></p>\n<ul>\n<li>云函数投递：事件总线支持通用 HTTP 协议的 webhook 直接投递，如果您的投递目标对于请求格式有严格要求，建议先通过云函数完成投递事件格式转换，再通过 EB 将原始事件直接发送给指定函数，完成推送链路搭建</li>\n</ul>\n<p><img src=\"https://docimg6.docs.qq.com/image/ECG6Be4HFGdXqRHVQquWGA.png?w=1216&#x26;h=894\"></p>\n<ol start=\"4\">\n<li>告警链路测试</li>\n</ol>\n<p>配置完成后，回到事件集控制台，选择刚刚已绑定的事件集，单击发送事件，可以选择已绑定的事件规则模版，单击发送进行测试。</p>\n<p>注：测试模版里只展示 data 字段里的内容，其它字段已固定，无法自定义修改。</p>\n<p><img src=\"https://docimg5.docs.qq.com/image/a63b9-GJAMZtmv6gkPLi5Q.png?w=1280&#x26;h=405.8124174372523\"></p>\n<p><img src=\"https://docimg10.docs.qq.com/image/7f4u4wAot7j0-0zLge3-4A.png?w=1280&#x26;h=694.4329896907217\"></p>\n<p>配置完成后，即可在腾讯云事件总线控制台，完成告警规则的查看与管理。</p>\n<p>识别下方 👇 二维码，进入「事件总线」交流群</p>\n<img src=\"https://qcloudimg.tencent-cloud.cn/raw/dd4f0a2cc7a171efe8d89aae9b55a600.png\" width=\"200\">\n<hr>\n<blockquote>\n<p><strong>传送门：</strong></p>\n<ul>\n<li>GitHub: <a href=\"https://github.com/serverless/serverless/blob/master/README_CN.md\">github.com/serverless</a></li>\n<li>官网：<a href=\"https://serverless.com/\">serverless.com</a></li>\n</ul>\n</blockquote>\n<p>欢迎访问：<a href=\"https://serverlesscloud.cn/\">Serverless 中文网</a>，您可以在 <a href=\"https://serverlesscloud.cn/best-practice\">最佳实践</a> 里体验更多关于 Serverless 应用的开发！</p>","tableOfContents":"<ul>\n<li><a href=\"/best-practice/2021-12-15-eb/#01-%E8%83%8C%E6%99%AF%E4%BB%8B%E7%BB%8D\">01. 背景介绍</a></li>\n<li><a href=\"/best-practice/2021-12-15-eb/#02-%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1\">02. 架构设计</a></li>\n<li><a href=\"/best-practice/2021-12-15-eb/#03-%E6%93%8D%E4%BD%9C%E6%AD%A5%E9%AA%A4\">03. 操作步骤</a></li>\n</ul>"},"previousBlog":{"id":"44398282-4e90-598e-b188-5e5dc9ed194b","frontmatter":{"thumbnail":"https://qcloudimg.tencent-cloud.cn/raw/6d6bcba1df7d10f01db0674358f0267d.jpg","authors":["杜佳辰"],"categories":["best-practice"],"date":"2021-12-16T00:00:00.000Z","title":"EventBridge 最佳实践场景二：使用 EventBridge + SCF 实现服务器异常的自动回滚","description":"本文以服务器异常为例为您介绍自动化运维架构快速搭建的方法。","authorslink":null,"translators":null,"translatorslink":null,"tags":["Serverless","云函数"],"keywords":null,"outdated":null},"wordCount":{"words":126,"sentences":26,"paragraphs":26},"fileAbsolutePath":"/opt/build/repo/content/best-practice/2021-12-16-eb.md","fields":{"slug":"/best-practice/2021-12-16-eb/","keywords":["serverless","无服务器","云函数","推送","告警","事件","tencent","docs","qq"]}},"nextBlog":{"id":"f93d5f8a-4f3a-52e8-9389-b64d19cd944b","frontmatter":{"thumbnail":"https://qcloudimg.tencent-cloud.cn/raw/d2bf1ac65a0546c95e8e296b837848d4.jpg","authors":["云函数 & 云开发"],"categories":["best-practice"],"date":"2021-12-12T00:00:00.000Z","title":"腾讯云营销大促一站式解决方案，专注微信生态业务成功","description":"从低代码开发到测试上线，全程保障电商 / 零售等行业营销活动安全稳定。","authorslink":null,"translators":null,"translatorslink":null,"tags":["Serverless","云函数"],"keywords":null,"outdated":null},"wordCount":{"words":133,"sentences":29,"paragraphs":29},"fileAbsolutePath":"/opt/build/repo/content/best-practice/2021-12-12-tcb-scf-weda.md","fields":{"slug":"/best-practice/2021-12-12-tcb-scf-weda/","keywords":["serverless","函数计算","云函数","width","tencent"]}}},"pageContext":{"isCreatedByStatefulCreatePages":false,"blogId":"36570569-7eef-52ad-a4ec-98de550dbd95","previousBlogId":"44398282-4e90-598e-b188-5e5dc9ed194b","nextBlogId":"f93d5f8a-4f3a-52e8-9389-b64d19cd944b"}}}