Custom Webhook messages
Published 21 October 2021
You can set a custom Webhook message to be sent whenever any alert begins, escalates, de-escalates or ends. This is necessary to integrate with some third-party tools that require a specific JSON format, such as Microsoft Teams. An example message to be used for Microsoft Teams is shown below.
Custom message parameters
The following parameters can be used within a custom message.
Parameter | Description | Example |
---|---|---|
{{alert-id}} | Id of the alert | 1234 |
{{alert-name}} | Name of the alert | Disk space alert |
{{alert-target-name}} | Name of the alert target | localhost\sql2019 |
{{alert-status}} | Status of the alert | Raised |
{{alert-severity}} | Severity of the alert | High |
{{alert-raised-time}} | When the alert was originally raised | 2022-10-12 17:46:30.2567915Z |
{{alert-event-time}} | When this event occurred (different to the raised time for Escalated, DeEscalated, or Ended alert-status types) | 2022-10-12 18:02:12.1651874Z |
{{alert-url}} | Alert details Url of the alert | https://sql-monitor/Alerts/localhost/Details/4521988 |
{{base-monitor-guid}} | Guid identifying the Base Monitor service | a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6 |
Uniquely identifying alerts
Sometimes it will be helpful to uniquely identify a SQL Monitor alert in another system. An {{alert-id}} is guaranteed to be unique to a single Base Monitor, but is not unique across multiple Base Monitors. To uniquely identify an alert globally in an environment which is fed alerts by multiple Base Monitors, use the combination of {{base-monitor-guid}} and {{alert-id}}.
Using custom Webhook messages to integrate with Microsoft Teams
Custom Webhook messages can be used to send alert notifications to Microsoft Teams using connectors. An example custom message to be sent to the URL of the Microsoft Teams installation is shown below.
{ "@context": "http://schema.org/extensions", "@type": "MessageCard", "summary": "SQL Monitor Alert [{{alert-id}}] - {{alert-name}}", "sections": [{ "activityTitle": "SQL Monitor Alert [{{alert-id}}] - {{alert-name}}", "activitySubtitle": "Reported on {{alert-target-name}}", "activityImage": "", "facts": [{ "name": "Status", "value": "{{alert-status}}" }, { "name": "Level", "value": "{{alert-severity}}" }], "markdown": true }], "potentialAction": [{ "@type": "OpenUri", "name": "View Alert", "targets": [ { "os": "default", "uri": "{{alert-url}}" } ] }] }
This will result in the following type of notification being received within Microsoft Teams. You can adjust the custom message to change the information sent and subsequently shown within Microsoft Teams.