salesforce_使用REST端点将VictorOps与Salesforce集成

salesforce

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

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

When you have a live application with real users, problems don’t show up according to your schedule. You need a way to manage and resolve issues that come up all of a sudden, and this process needs to be as simple and painless as possible. This is where VictorOps comes in. It allows you to manage who is responsible for fixing live problems, enables communication among the team when these issues arise, and integrates with the rest of your systems to make detecting problems a piece of cake.

当您有一个具有真实用户的实时应用程序时,问题不会根据您的计划出现。 您需要一种方法来管理和解决突然出现的问题,并且此过程需要尽可能简单和轻松。 这是VictorOps出现的地方。它使您可以管理负责解决现场问题的人员,在出现这些问题时在团队之间进行交流,并与其他系统集成在一起,从而使发现问题变得轻而易举。

In this article, we’ll cover how you can use VictorOps as a REST endpoint to integrate it with other services. In particular, we’ll focus on SalesForce integration. To make this integration, you’ll need a VictorOps account.

在本文中,我们将介绍如何使用VictorOps作为REST端点将其与其他服务集成。 特别是,我们将专注于SalesForce集成。 要进行此集成,您需要一个VictorOps帐户

集成和REST端点 (Integration and the REST Endpoint)

First of all, what do we mean when we say that VictorOps gives you a “REST endpoint”? The idea is that VictorOps allows you to access resources using a RESTful API over HTTP. What’s the point, you ask? Well, it is usually very easy to make HTTP requests, and we can use the REST endpoint to quickly set up integrations with other services. For example, a lot of companies use Nagios to monitor services within a deployment. We can integrate VictorOps with Nagios using a plugin, which simply takes alerts and pushes them over to VictorOps’s REST endpoint. The breadth of services you can integrate using the REST endpoint is incredible; as long as you have a little code that can fire off some HTTP requests to ‘alert.victorops.com’, you can make the integration happen.

首先,当我们说VictorOps为您提供“ REST端点”时,我们是什么意思? 这个想法是VictorOps允许您使用RESTful API通过HTTP访问资源。 你问什么意思? 嗯,发出HTTP请求通常非常容易,我们可以使用REST端点快速建立与其他服务的集成。 例如,许多公司使用Nagios监视部署中的服务。 我们可以使用插件将VictorOps与Nagios集成在一起,该插件只需获取警报并将其推送到VictorOps的REST端点即可。 您可以使用REST端点集成的服务的广度令人难以置信。 只要您有一些代码可以触发对“ alert.victorops.com”的一些HTTP请求,就可以进行集成。

Let’s take a look at how to set up one of these integrations. A lot of teams use Salesforce as a communications medium. We want people who use Salesforce (which generally includes people on the non-technical side of things) to be able to communicate with the people working with their company’s servers. So, when cases are created in Salesforce, we should get alerts through VictorOps. This allows you to have one place (VictorOps) where you can see IT problems arise throughout your infrastructure. Let’s see how to set up that integration.

让我们看一下如何设置这些集成之一。 许多团队将Salesforce用作沟通媒介。 我们希望使用Salesforce的人员(通常包括非技术方面的人员)能够与使用其公司服务器的人员进行通信。 因此,在Salesforce中创建案例时,我们应该通过VictorOps获得警报。 这样一来,您就可以在一个地方(VictorOps)看到整个基础架构中出现的IT问题。 让我们看看如何设置该集成。

Salesforce整合 (Salesforce Integration)

Salesforce has a way to hook in little bits of code that decide what to do when specific things called “triggers” happen. These little bits of code are written in a language called “Apex” (which is more or less specific to Salesforce) that is meant to have a syntax very similar to Java. Fortunately, you don’t have to spend any of your time learning how to write Apex in order to get Salesforce integration to work since the kind folks at VictorOps have a repository that contains the required code snippets.

Salesforce有一种方法可以挂接一些代码,这些代码决定了发生“触发器”的特定事件时该怎么做。 这些少量的代码用称为“ Apex ”的语言(或多或少特定于Salesforce)编写,该语言的语法与Java非常相似。 幸运的是,由于VictorOps的同类人员都有一个包含所需代码段的存储库,因此不必花费任何时间学习如何编写Apex即可使Salesforce集成正常工作。

For security reasons, we need to tell Salesforce that our code is going to be making requests to the VictorOps REST endpoint. To do that, we’ll have to add “http://alert.victorops.com/” as a remote site by going through ‘Security Controls => Remote Site Settings => New Remote Site’ in the Salesforce dashboard. After you do that, you should see this on the ‘All Remote Sites’ page:

出于安全原因,我们需要告诉Salesforce我们的代码将向VictorOps REST端点发出请求。 为此,我们必须通过在Salesforce仪表板中通过“安全控制=>远程站点设置=>新远程站点”来将“ http://alert.victorops.com/ ”添加为远程站点。 完成此操作后,您应该在“所有远程站点”页面上看到以下内容:

All Remote Sites page in Salesforce

Before we can get the Apex code talking with VictorOps, we need to put in our API and route keys from VictorOps into the Apex code. Get yourself of a copy of the code first from this repository. Then, we need the right keys from VictorOps. From the VictorOps dashboard, we go to ‘Settings => Integrations REST Endpoint’. After enabling the integration, you’ll see a URL like this:

在获得与VictorOps对话的Apex代码之前,我们需要放入我们的API并将密钥从VictorOps路由到Apex代码中。 首先从此存储库中获取代码的副本。 然后,我们需要VictorOps的正确按键。 从VictorOps仪表板,转到“设置=>集成REST端点”。 启用集成后,您将看到如下URL:

API Key URL in VictorOps

The part of the URL in red is your “API key”. Now, we’ll create a routing key. Your routing key allows you to route certain alerts to certain groups of people within your VictorOps organization. To set one up, again head over to ‘Settings’ in the VictorOps dashboard, click on ‘Integrations’ and down to ‘Incident Routing’. Add a rule with a routing key (e.g. “salesforce_integration”). At this point, you’ll probably be routing that routing key to ‘everyone’:

URL中红色部分是您的“ API密钥”。 现在,我们将创建一个路由密钥。 您的路由密钥使您可以将某些警报路由到VictorOps组织内的特定人群。 要进行设置,请再次转到VictorOps仪表板中的“设置”,单击“集成”,然后单击“事件路由”。 添加带有路由键的规则(例如“ salesforce_integration”)。 此时,您可能会将路由键路由到“所有人”:

Routing Key in VictorOps

Now, in the Apex code, you should find a file named “VictorOpsTimeLine Apex Class”, with a bit of text in it that looks like this:

现在,在Apex代码中,您应该找到一个名为“ VictorOpsTimeLine Apex类”的文件,其中包含一些文本,如下所示:

http://alert.victorops.com/integrations/generic/20131114/alert/$YOUR_API_KEY_HERE/$ROUTING_KEY_HERE

Edit it to add your API and routing keys.

编辑它以添加您的API和路由键。

Next up, we’ll add in the Apex code into Salesforce. Head over to ‘Setup => Apex Classes’ in Salesforce and then simply upload the files in this repository that end in ‘Class’. For example, whereas ‘VO Alert Test Class’ goes in the classes. You should end up with:

接下来,我们将Apex代码添加到Salesforce中。 转到Salesforce中的“设置=> Apex类”,然后仅在该存储库中上传以“类”结尾的文件。 例如,“ VO Alert Test Class”属于此类。 您应该最终得到:

Salesforce Apex Classes List

We also need to set up the triggers. To do that, head over to the Developer Console via ‘Setup => Apex Classes => Developer Console’. Click on ‘File => New => Apex Trigger’. The name should correspond to the file name of the trigger (there are two of them) and the sObject should be “Case” (since we want this trigger to fire when cases are created or resolved).

我们还需要设置触发器。 为此,请通过“设置=> Apex类=>开发人员控制台”转到开发人员控制台。 单击“文件=>新建=> Apex触发器”。 名称应与触发器的文件名相对应(其中有两个),并且sObject应该为“ Case”(因为我们希望在创建或解决案例时触发此触发器)。

Salesforce Developer Console

Then, just paste in the trigger code and save.

然后,只需粘贴触发代码并保存。

In order to finally deploy this code to a production environment (as opposed to the developer sandbox you’ve been working in so far) you’ll need to deploy a changeset from the sandbox to the production organization.

为了最终将此代码部署到生产环境(与您到目前为止一直在开发的沙盒相对),您需要将一个变更集从沙盒部署到生产组织。

To test out the integration, you can create a new case in Salesforce and you should see it show up as an alert inside VictorOps like this:

要测试集成,您可以在Salesforce中创建一个新案例,您应该看到它在VictorOps内部显示为警报,如下所示:

Case Result in VictorOps

其他整合 (Other Integrations)

We’ve outlined the Salesforce integration using the REST endpoint, but the procedures for integrating other platforms are remarkably similar because VictorOps can communicate with many different platforms via the REST endpoint. For example, Sensu is a nice way to monitor your system based on a set of checks, and you can use the REST endpoint in order to make its alerts show up on VictorOps so you can deal with them in a coordinated fashion.

我们已经概述了使用REST端点的Salesforce集成,但是集成其他平台的过程非常相似,因为VictorOps可以通过REST端点与许多不同的平台进行通信。 例如, Sensu是一种基于一组检查来监视系统的好方法,并且您可以使用REST端点,以使其警报显示在VictorOps上,以便您以协调的方式处理它们。

In fact, rolling your own integration is fairly easy since VictorOps has very good documentation on how you can get alerts into the system. With an API, a simple HTTP library and a couple of hours, you can get information from nearly any service into the alerts on your VictorOps dashboard.

实际上,由于VictorOps有非常好的文档说明如何将警报发送到系统中,因此滚动自己的集成非常容易。 借助API,简单的HTTP库和几个小时,您可以将几乎所有服务的信息都输入到VictorOps仪表板上的警报中。

By providing such easy integration, VictorOps lets you deal with complex problems in a much more efficient and timely manner because you don’t have to check a million sources of information to figure out where and when the problems show up.

通过提供这种简单的集成,VictorOps可以使您以更加有效和及时的方式处理复杂的问题,因为您不必检查一百万个信息源即可确定问题的出现时间和地点。

进一步查看和阅读 (Further Viewing and Reading)

That brings us to the end of this tutorial, but if you have any other clever ideas for VictorOps integrations, feel free to suggest them in the comments. For more on the topic, here’s a list of useful resources you can check out:

这使我们结束了本教程的结尾,但是如果您对VictorOps集成还有其他聪明的主意,请随时在评论中提出。 有关该主题的更多信息,这是您可以检出的有用资源的列表:

翻译自: https://www.sitepoint.com/integrating-victorops-salesforce-using-rest-endpoint/

salesforce

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值