Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a VictorOps notification channel for alerts #3
Alert Notifications with VictorOps
To integrate VictorOps with Scout's Alert Notification system, you can utilize the Webhook feature on the Application > Notification Channels page.
In order for Scout and VictorOps to be able to work together, you need to use a third-party service called Zapier.
Zapier is a service which allows you to connect different web services together to make custom work-flows.
First of all you will need to create an account with Zapier, and once you have done this, you can go ahead and create a Zap, by clicking on the Make a Zap! button on the top right-hand side of the screen, as shown in the image below.
You need to create a Trigger (for Scout) and an Action (for VictorOps) in order to make the two systems able to communicate. First of all, create the trigger by selecting Webhooks by Zapier as the App you want to work with.
Next you will need to select the type of trigger that you want, select Catch Hook. Next you will be given a URL, which is the Webhook that we will use to link to in Scout. Copy this URL and then open up Scout.
In Scout, navigate to Application > Notification Channels and create a new Webhook, like the picture below, copying in the Zapier URL.
Next you will need to add or edit a Notification Group to include this new channel.
Create an Alert
At this point if you try to carry on creating the Zap in Zapier, it will try to pull a sample Alert from Scout using the Webhook that we set up. The reason it does this is that it requires sample data from Scout in order to understand the format of the trigger, and what fields are available from Scout. However, at this point there are not going to be any Alerts it can use because this Webhook has only just been set up. So here you have two options:
We strongly recommend the first option, because later on when you are specifying the message that you are going to send to VictorOps, if you do not have sample data, you will not be able to use data that came from Scout.
To create a quick Alert, open up Scout, go to Alert > Alert Conditions and create a simple condition that will alert, and choose the VictorOps Notification Group we set up earlier.
Choose the Alert in Zapier
After the Alert has occurred in Scout, go back to Zapier and click the Ok, I did this button and it will connect with Scout and look for an Alert with this matching Webhook. Choose this as the sample you want to use and click Continue.
Create a VictorOps Action
Next you need to add an Action step to the work-flow, this is the part were we integrate VictorOps. Click Add a Step on the left-hand side of the page.
Next click the Action/Search option, and you will be given the option to choose an app to connect.
VictorOps does not provide a dedicated App within Zapier, so instead, we will integrate VictorOps using an email service. VictorOps can provide a special email account for each user that will listen for alerts and relay them to the VictorOps system. We will need to do a small amount of configuration in VictorOps, but first in Zapier, choose Email by Zapier as the Action App, and then a new Action will be created on the left-hand side of the screen.
There is only one type of Action that you can choose to perform with Zapier's Email Action, called Send Channel Message, so pick this and click continue.
Before we go any further, let's configure VictorOps to expose this special email address to incoming alerts from Zapier. Open up VictorOps and log in, then from the menu at the top of the screen, click on Settings > Alert Behaviour > Integrations. Here you will be presented with a list of Integrations that VictorOps provides. Search for "Email" and open this Integration.
Next, click the Enable Integration button and VictorOps will generate an email address for you to use.
Copy this email address here because we are going to use this in Zapier to integrate VictorOps.
Continue Configuring Zapier
That is all the configuration that we need to do in VictorOps, so open Zapier up again and let's continue configuring the Action. The next step is the message configuration. You can configure many aspects of the message that will be sent, such as which email address to use, and the contents of the email. For email address, paste in the the VictorOps email that we copied earlier, but be careful to remove the '+$routing_key' part of the address. Routing Keys allow you to route emails to different sections of VictorOps, but for the purpose of this explanation, we are not going to use them. If you are interested in this feature then please take a look at the VictorOps documentation.
The body field is a good place to choose data that comes from the Scout Alert (shown in green) and pass this information through to VictorOps. It is only possible to pull this data from Scout here if you created an Alert earlier like we advised.
Then you can send a test message to VictorOps to preview how it will look.
Then all that's left to do is to give your Zap a descriptive name and enable it.
Now everything is set up so that whenever an Alert occurs in Scout which is linked to this Notification Channel, you will see a message in VictorOps.