devops_ChatOps简介:Devops遇到IM

devops

This article is sponsored by VictorOps. Thank you for supporting the sponsors who make SitePoint possible!

本文由VictorOps赞助。 感谢您支持使SitePoint成为可能的赞助商!

Developers often use email as their primary mode of communication. Be it downtime alerts, 500 errors or repository commits — all of them are redirected to your email account so that everything can be found in a single place.

开发人员经常使用电子邮件作为主要的沟通方式。 无论是停机警报,500个错误还是存储库提交,所有这些都将重定向到您的电子邮件帐户,以便可以在一个地方找到所有内容。

But email isn’t really suited to this kind of task. Email makes real-time communication difficult, and conversations can easily become unwieldy, with long delays and a lack of immediacy, particularly when you’re communicating with people in different timezones.

但是电子邮件并不真正适合这种任务。 电子邮件使实时通信变得很困难,并且对话很容易变得笨拙,延迟时间长且缺乏即时性,尤其是当您与不同时区的人进行通信时。

Chat, on the other hand, offers a more immediate way to resolve an issue. You can see who is online at a particular moment, you can share information with multiple people to receive feedback quickly, and you can even perform actions from right within the chat client, via integrations with services like GitHub’s Hubot.

另一方面,聊天提供了更直接的解决问题的方法。 您可以看到在特定时刻谁在线,可以与多人共享信息以快速获得反馈,甚至可以通过与GitHub的Hubot之类的服务集成,在聊天客户端中直接执行操作。

We’ve come a long way from the days of Yahoo, AOL and Microsoft Messenger. Chat is no longer just a text-based interaction between two people — it’s developed into something more, something productive.

与Yahoo,AOL和Microsoft Messenger相比,我们已经走了很长一段路。 聊天不再只是两个人之间基于文本的交互,它已经发展成为一种更具生产力的产品

This article will cover the emerging trend of ChatOps, outlining some popular uses of chat in a devops setting, and then explain how you can take your ChatOps further with advanced integrations with VictorOps.

本文将介绍ChatOps的新兴趋势,概述在devops设置中聊天的一些流行用法,然后说明如何通过与VictorOps的高级集成使ChatOps进一步发展

聊吧 (Let’s Chat)

Popularized by GitHub, ChatOps is putting tools in the middle of the conversation. With development teams often distributed globally, there is a need for a centralized communication system which also automates certain processes like continuous deployment. GitHub started the trend with their bot, Hubot.

ChatOps在GitHub上很受欢迎,它将工具放在了对话的中间。 由于开发团队通常分布在全球各地,因此需要一种集中式通信系统,该系统还可以使某些过程(如连续部署)自动化。 GitHub的机器人Hubot开始了这一趋势。

There are many popular chat applications in use in the tech industry. I recently wrote about using Slack for workplace collaboration, but HipChat is also popular. Most of the best chat clients offer direct messaging, multiple channels for different subjects or areas, and advanced file-sharing and integration abilities.

在技​​术行业中,有许多流行的聊天应用程序正在使用。 我最近写过关于使用Slack进行工作场所协作的文章 ,但是HipChat也很受欢迎。 大多数最好的聊天客户端都提供直接消息传递,针对不同主题或领域的多个渠道以及高级文件共享和集成功能。

These apps are capable of making a world of difference to the development cycle. There are different chat-based tools and commands for different tasks, such as starting new instances of virtual machines, sending newsletters or deploying code to your main server. Traditionally, each of these tasks would involve working on different tools but with programmable chat bots these tasks can be performed by simple commands run on the chat application.

这些应用程序能够使开发周期与众不同。 对于不同的任务,有不同的基于聊天的工具和命令,例如启动虚拟机的新实例,发送新闻通讯或将代码部署到主服务器。 传统上,这些任务中的每一个都涉及使用不同的工具,但是使用可编程的聊天机器人,这些任务可以通过在聊天应用程序上运行的简单命令来执行。

Imagine connecting with Amazon Web Services to spring up instances with just a single chat command, or deploying your latest commit to the server with the help of GitHub integrations. Or how about checking how many visitors your website has through an analytics system? Perhaps you’re just happy checking your team’s progress through Trello or Asana within your chat application of choice?

想象一下与Amazon Web Services连接以仅通过一个聊天命令即可启动实例,或者借助GitHub集成将最新提交部署到服务器。 或者如何通过分析系统检查您的网站有多少访客? 也许您只是很乐意在您选择的聊天应用程序中通过Trello或Asana检查团队的进度?

ChatOps can increase the efficiency of your team, saving time that would otherwise be wasted on redundant processes.

ChatOps可以提高团队效率,节省时间,否则这些时间将浪费在冗余流程上。

A standard chat app is certainly useful in improving developer communications. But when it comes to helping developer teams manage incidents, an integration with an on-call alert and management platform like VictorOps is even better.

一个标准的聊天应用程序无疑对改善开发人员的沟通很有用。 但是,在帮助开发人员团队管理事件方面,与诸如VictorOps之类的即时警报和管理平台的集成甚至更好。

VictorOps和“待命”的乐趣 (VictorOps and the joys of being ‘on-call’)

The concept of being on-call is borrowed from the medical field. Doctors and nurses need to be available at all hours to manage emergencies, so they will often follow a roster to make sure someone is always on-deck. Similarly in the devops world, an error or downtime to your site or service might occur when you are asleep, especially with services with users in different timezones. Up until now, you probably had a team member assigned to handle such errors, and they’d receive alerts via email when something went wrong.

待命的概念是从医学领域借来的。 医生和护士需要随时待命以管理紧急情况,因此他们经常会按照名册来确保有人在甲板上。 同样,在devops世界中,当您处于睡眠状态时,可能会发生站点或服务的错误或停机,尤其是对于具有不同时区的用户的服务。 到现在为止,您可能已经指派了一个团队成员来处理此类错误,一旦出现问题,他们将通过电子邮件接收警报。

VictorOps aims to make this process a bit more elegant, by providing a centralized system to fix live problems, communicate with team-members and then learn from what went wrong once the crisis has passed.

VictorOps的目的是通过提供集中式系统来解决现场问题,与团队成员进行交流,然后从危机中汲取教训,从而使这一过程更加优雅。

VictorOps Home Page

Let’s look at how VictorOps handles crisis management and sends outgoing notifications and incoming alerts, before we move on to talk about how to integrate the service with an existing chat application, HipChat.

在继续讨论如何将服务与现有聊天应用程序HipChat集成之前,让我们看一下VictorOps如何处理危机管理并发送传出通知和传入警报。

VictorOps中的错误报告 (Error Reporting in VictorOps)

If you’ve assigned someone to be on-call for a particular site or app in VictorOps, incidents will also show up on the VictorOps timeline like this:

如果您已指定某人在VictorOps中为特定站点或应用程序进行待命,则事件也会显示在VictorOps时间轴上,如下所示:

Incident report

An email is also sent to the concerned party.

还会向相关方发送电子邮件。

Incident email

If you’re not going to be available, a co-worker can take the on-call responsibilities for you. When you’re back on-board, you can take them back. The VictorOps bot Victor, who you’ll be formally introduced to later on, explains that pretty well when you are given the tour for the first time.

如果您不在家,同事可以为您承担通话中的责任。 当您返回机上时,可以将其带回。 稍后将向您正式介绍VictorOps机器人Victor,当您第一次参加巡回演出时,他会很好地解释这一点。

VictorOps bot explanation

If you’re not satisfied with just an email being sent to someone when an incident is created, don’t be disappointed. VictorOps supports webhooks, which let you perform a custom action through a callback from VictorOps.

如果您对事件发生时仅发送给某人的电子邮件感到不满意,请不要失望。 VictorOps支持webhooks,使您可以通过VictorOps的回调执行自定义操作。

传出通知-Webhooks (Outgoing notifications — Webhooks)

You may be accustomed with webhooks, especially if you’re familiar with continuous integration. With webhooks, you can specify a callback from the VictorOps application when an incident is reported to a different application. This callback can be used to perform a variety of functions — start or stop a process on a server, send out a bunch of emails, put up a status page, or anything else that comes to your mind.

您可能已经习惯了Webhooks,尤其是在您熟悉持续集成的情况下 。 使用webhooks,您可以在将事件报告给其他应用程序时从VictorOps应用程序指定回调。 此回调可用于执行各种功能-启动或停止服务器上的进程,发送大量电子邮件,设置状态页或您想到的其他任何功能。

A POST request is sent from VictorOps to your application, containing an incident, the summary and a message. It’s identified and authenticated by an HTTP header X-Victorops-Signature.

POST请求从VictorOps发送到您的应用程序,其中包含事件,摘要和消息。 它由HTTP标头X-Victorops-Signature标识和认证。

For instance, if you’re running an application written in core PHP and a MySQL error occurs, the error trace might be displayed on a webpage. You could avoid this by using a webhook, which temporarily shows an error page while you fix the problem.

例如,如果您正在运行用核心PHP编写的应用程序,并且发生MySQL错误,则错误跟踪可能会显示在网页上。 您可以通过使用Webhook避免这种情况,该Webhook在修复问题时会临时显示错误页面。

For more on using webhooks, head over to the documentation, which lists the steps of generation and authentication in detail.

有关使用Webhooks的更多信息,请转到文档 ,其中详细列出了生成和认证的步骤。

传入警报-REST端点 (Incoming alerts — REST endpoints)

Now you know how webhooks work, what if you wanted to reverse the information flow and tell VictorOps about something? This is where REST endpoints come into the picture.

现在您知道了webhooks的工作原理,如果您想逆转信息流并将某些事情告诉VictorOps ,该怎么办? 这就是REST端点出现的地方。

VictorOps accepts alerts from any source through an HTTPS request. You can generate alerts using these requests.

VictorOps通过HTTPS请求接受来自任何来源的警报。 您可以使用这些请求生成警报。

Here’s more on the REST endpoints and a guide to setting up the VictorOps integration.

这是有关REST端点更多信息,以及有关设置VictorOps集成的指南

将HipChat与VictorOps集成 (Integrating HipChat with VictorOps)

Now you have a bit of a handle on some of the things VictorOps can do out of the box, let’s look at how to integrate it into your existing chat app.

现在,您已经掌握了VictorOps可以立即使用的某些功能,让我们看看如何将其集成到现有的聊天应用程序中。

VictorOps currently provides an easy integration with HipChat, although Slack integration is also coming soon. This integration ties your VictorOps timeline to a particular chat room on HipChat. Anything posted on HipChat is immediately transferred to VictorOps, and vice versa.

VictorOps当前提供了与HipChat的轻松集成,尽管Slack集成也即将推出。 这种集成将您的VictorOps时间轴与HipChat上的特定聊天室联系在一起。 HipChat上发布的任何内容都会立即转移到VictorOps,反之亦然。

To set up the HipChat integration, you’ll only need to follow a few simple steps.

要设置HipChat集成,您只需执行几个简单的步骤。

  • In your VictorOps integration, enable the HipChat integration to generate a unique URL. You may select the types of messages to be sent and how they should be displayed under the preferences

    在VictorOps集成中,启用HipChat集成以生成唯一的URL。 您可以选择要发送的消息类型以及在首选项下应如何显示消息
  • In your HipChat settings, select the chat room to integrate and add the generated URL as a new private integration.

    在HipChat设置中,选择要集成的聊天室并将生成的URL添加为新的私人集成。

It’s really that easy. Once you are done with it, messages on HipChat are transferred to VictorOps and vice versa. You can manage a VictorOps timeline from your favorite chat app, bringing the functionality of both together. For a detailed tutorial with screenshots on the integration, check out the VictorOps documentation.

真的很容易。 完成后,HipChat上的消息将传输到VictorOps,反之亦然。 您可以从自己喜欢的聊天应用程序管理VictorOps时间轴,将两者的功能结合在一起。 有关集成截图的详细教程,请查阅VictorOps文档

Let’s test it out. Here’s me posting a message on HipChat.

让我们测试一下。 这是我在HipChat上发布消息。

Message on HipChat

Move over to VictorOps to see the effect.

移至VictorOps以查看效果。

VictorOps receiving HipChat message

Let’s try the opposite, I’ll post a message to the VictorOps timeline.

让我们尝试相反的做法,我将一条消息发布到VictorOps时间轴。

Posting on VictorOps

And there it is on HipChat.

它在HipChat上。

HipChat receiving VictorOps message

You’ll never miss a thing, no matter which app you have open!

无论您打开哪个应用程序,您都不会错过任何东西!

Hubot整合 (Hubot integration)

Victor's personality

Although VictorOps provides a chat bot, @victor, who’s pretty friendly and helps you set things up for the first time, you might want to bring across GitHub’s own Hubot to the VictorOps timeline, for some advanced functionality and a bit of fun.

尽管VictorOps提供了一个聊天机器人@victor ,它非常友好并且可以帮助您首次进行设置,但是您可能希望将GitHub的Hubot引入VictorOps时间轴,以获得一些高级功能和一些乐趣。

To do so, you need to follow instructions to set up Hubot, followed by the integration of VictorOps into Hubot. Roughly, you’ll need to go through the following steps (assuming you already have NodeJS installed).

为此,您需要按照说明设置Hubot ,然后将VictorOps集成到Hubot中。 大致来说,您需要执行以下步骤(假设您已经安装了NodeJS)。

  • Install the Hubot generator from GitHub.

    从GitHub安装Hubot生成器。

    npm install -g yo generator-hubot
  • Install hubot in its own directory on your server.

    在服务器上自己的目录中安装hubot。

    yo hubot
Installing Hubot
  • Add the VictorOps adapter to Hubot’s dependencies by editing the file package.json and run npm install.

    通过编辑文件package.json并运行npm install将VictorOps适配器添加到Hubot的依赖项中。

    ...
    "dependencies": {
      "hubot-victorops": ">=0.0.2",
      ...
    }
    ...
  • Get the VictorOps Key from your VictorOps dashboard under integrations (https://portal.victorops.com/dash/your-company-slug/#/advanced).

    从VictorOps仪表板的集成下( https://portal.victorops.com/dash/your-company-slug/#/advanced )获取VictorOps密钥。

  • Run Hubot using the VictorOps adapter with the key.

    使用带有密钥的VictorOps适配器运行Hubot。

    HUBOT_VICTOROPS_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx bin/hubot --adapter victorops
Running Hubot adapter key

Once it’s up and running, you can use it in your timeline! For production, consider storing the HUBOT_VICTOROPS_KEY as an environment variable. If you need custom functionality, you can create your scripts in CoffeeScript under the scripts directory. A basic example is provided by default for your reference.

一旦启动并运行,您就可以在时间轴中使用它了! 对于生产,请考虑将HUBOT_VICTOROPS_KEY存储为环境变量。 如果需要自定义功能,则可以在CoffeeScript的scripts目录下创建scripts 。 默认情况下提供一个基本示例供您参考。

You can start with the basic help command to help you see a list, which you can use to try out a few different things. Including some slightly less-productive activities!

您可以从基本的help命令开始,以帮助您查看列表,您可以使用它来尝试一些不同的事情。 包括一些生产力稍低的活动!

Hubot at its best
Mischief with Hubot

最后的想法 (Final Thoughts)

ChatOps offers a wealth of benefits over traditional communications methods. We’ve given you a basic overview of the concept, advice on bringing it across to your own organization, and a guide to taking it further with on-call alert and management platform VictorOps and Hubot, the advanced (and occasionally mischievous!) chat bot.

与传统的通信方法相比,ChatOps提供了很多好处。 我们为您提供了有关该概念的基本概述,将其推广到您自己的组织的建议,以及通过呼叫警报和管理平台VictorOps和Hubot进一步完善该指南的指南,高级(有时是调皮!)聊天机器人。

If you want more information about ChatOps, VictorOps will be hosting a live “ChatOps Unplugged” webinar, where they’ll give an intro to ChatOps, explain the benefits of ChatOps, specific examples on what can be done, the tools that you can use to accomplish them (including Hubot), and how to get started.

如果您想了解有关ChatOps的更多信息,VictorOps将举办一个实时的“ ChatOps Unplugged ”网络研讨会,他们将向ChatOps进行介绍,解释ChatOps的好处,可以做的具体例子,以及您可以使用的工具。完成这些任务(包括Hubot)以及入门方法。

翻译自: https://www.sitepoint.com/introduction-chatops-devops-meets-im/

devops

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值