Webhooks are user-defined HTTP/s callbacks. In Monitis they can be configured to trigger alerts. When an alert occurs, Monitis makes an HTTP/s request to the URL configured for the Webhook. With Webhooks you can get data with both GET and POST methods in the following formats: JSON, XML, Query string.
To use Webhook in Monitis you need to add a Webhook contact. Once an alert via Webhook is sent, you can parse the request and use the alert params (metrics, values, etc.) for different types of a trigger-like functionality for configuring post-alert actions on your side.
Adding Webhook Contact
To add a new Webhook contact, go to the Alerts top menu.
The Contacts window will open.
Click the New Contact button.
The New Contact window will open.
Enter the First Name and Last Name for the contact.
Select Webhook from the Contact Type combo box.
Provide the destination URL for webhooks under the Webhook URL.
Select the Request Type: POST or GET.
Select the Data format: JSON, XML or Query string.
Select the Contact Group for the new contact.
Select the Time Zone for the contact.
Check the Enable Sensitive Alerting box if you want to enable it. See here about Sensitive Alerting.
You will be taken to the Alert Rules tab.
If you do not want this contact to receive alerts, click Don’t Receive Alerts for now.
Click Custom Configuration (Advanced) to configure alerts if you want this contact to receive alerts (see Alert Rules).
You will be shown a message asking to confirm the new Webhook contact.
Follow the instructions below to confirm your Webhook contact.
As soon as you add a Webhook contact we send a confirmation link by GET method to your provided URL with a ”confirmationURL” param in it.
Below is the structure of the confirmationURL param:
Just visit the link or send it by GET request to confirm the contact.
You will see a confirmation message in your browser.
If you need to resend the confirmation link, use the Resend button in the Contact Confirmation pop-up window.
The confirmation link will expire as soon as clicked (contact confirmed). If you click it again, you will see the respective message on the screen.
Alerting via Webhook is currently available in English only, independent of the set dashboard language: regardless of what language you select in dashboard, you will receive Webhook alerts in English.
Monitor Metrics List
You may want to implement some logic on your side to run it following receiving the alert, as this is what Webhook is best for. For instance, you may wish to terminate programmatically some process or maybe reboot your server if CPU load crosses your predefined threshold. For that, you will need to know in advance the exact names of the monitor metrics to have your code listen for them in the received alerts. You can find the full metric list per monitor type under Monitor Metrics.
Migration from URL Callback to Webhook
The new Webhook contact type replaces the current URL callback type.
Current plain text format used in the now deprecated URL callback contact type will be supported for the existing contacts until you edit them by changing the data format to XML, JSON or Query string. Once you do that your URL Callback contact will be converted into Webhook and you will no longer be able to receive alerts in plain text format.