Elastic
Get alerts from Elastic into Squadcast (using Watcher Alerting)
Last updated
Get alerts from Elastic into Squadcast (using Watcher Alerting)
Last updated
Note:
We'll be using Watcher (formerly known as X-Pack Alerting) for getting alerts from Elastic. You need to setup watcher for your elastic cluster. For more information on that, visit Getting Started with Watcher
We'll be using Watcher (formerly known as X-Pack Alerting) for getting alerts from Elastic.
Follow the steps below to configure a service so as to extract its related alert data from Elastic.
Squadcast will then process this information to create incidents for this service as per your preferences.
Navigate to Services -> Service Overview -> select or search for your Service. Expand the accordion -> In the Alert Sources section, click Add.
2. Select Elastic. Copy the displayed Webhook URL to configure it within Elastic. Finish by clicking Add Alert Source -> Done.
Important:
When an alert source turns Active, it’ll show up under Configured Alert Sources. You can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source. An Alert Source is active if there is a recorded incident via that Alert Source for the Service.
Now given the configurable nature of how Watcher alerting works in Elastic, we can generate our own custom alerts for almost anything we are monitoring in Elastic. Also, the payload JSON to be sent is defined by the user himself.
Note:
In this document, we'll go through setting up a watcher for monitoring the Heath of the Elastic Cluster as a sample criterion for triggering alerts.
We have assumed that the elasticsearch server is running at http://localhost:9200
Verify that Watcher is set up and running on your server.
Execute the following in your terminal.
You should get a response something like the following
2.Verify that the cluster health endpoint is functioning.
Execute the following in your terminal.
You should get a response something like the following
We'll be using the status
field in this response to decide whether to send alerts.
3.Configure a watch with a Webhook action for Squadcast and use a PUT request to add it to your watcher. NOTE :- Note: The watch below is set to always execute every 10 seconds for testing purposes. In most production environments you will want to update the trigger and condition to only execute the action when there is an issue to reduce noise. You may also want to add a throttle period to your Squadcast action. You can find detailed instructions on configuring each aspect of your watches in the Elastic Watcher Documentation. .
Execute the following in your terminal
Use the Elastic Webhook URL copied from the Squadcast dashboard in the url
field inside webhook
.
IMPORTANT : Like we had mentioned earlier, the payload JSON to the webhook it defined by the user himself. So, we have defined a format for the payload so as to make it most flexible for the end-user.
The payload JSON must have the following keys :-
event : This field can hold either "TRIGGER" or "RESOLVE"
id : This must have the same value for the "TRIGGER" and "RESOLVE" payloads and must be different from id
of other watches. So, it makes sense to use watch_id
for this field.
message : This would be the heading of the incident in the squadcast dashboard.
description : This would be the detailed description of the incident in the squadcast dashboard.
payload : This would be the whole ctx object. This is taken so as just to get some more metadata on the event which maybe useful in deduplicating.
So, a sample payload JSON would look like
Now, whenever the cluster status becomes red
, an incident will be created automatically in squadcast. Once it becomes green
, the incident will get automatically resolved.
NOTE
Just like watch for elastic cluster health, we can setup watch for other elastic metrics as well.
We have tried to do deduplication in Squadcast so that multiple triggers for the same incident would only create a single event in Squadcast dashboard. Still, try to configure watcher from your end to ensure minimal noise.