The built-in Grafana trigger initiates flows when it receives a request from a webhook in Grafana.
- Go to the Triggers panel in the palette, expand the App Triggers section and drag the trigger onto the canvas.
- Double-click the trigger (or click the pencil icon).
- Set the authenticating user, and then copy the URL — you'll use this to set up the webhook in Grafana. Alternatively, you can create an integration user and use it as the authenticating user.
- Click the Flood Control tab to edit the trigger's default flood control settings. For more information about these settings, see Trigger Flood Control.
- Connect the steps you want to run when xMatters receives a request to that URL.
You're now ready to configure Grafana to target the trigger.
Configure Grafana to send requests to the trigger URL
To have Grafana send alerts to the flow trigger, you need to configure a webhook and set it to use the trigger URL.
- In Grafana, go to Alerting > Notification channels.
- Create a new Notification channel and fill in the following fields:
- Name: xMatters
- Type: Webhook
- Url: Paste the trigger URL you copied previously.
- Add the target names of any recipients you want xMatters to notify when the alert fires.
- For example, if you want to notify Emma Pearson, Mary McBride, and the on-call members in the Monitor Team responsible for the service, you'd add ?recipients=epearson,mmcbride,monitor%20team to the URL.
- You must URL-encode any special characters or spaces in the target names.
- Optional: If you choose to use Basic Authentication, expand the Optional Webhook settings menu to enter your Username and Password.
- Click Save.
- Add this notification channel to any alert rules you'd like to connect with xMatters.
You're ready to use the webhook to trigger automated flows, including steps such as sending alerts and initiating incidents, though we always recommend testing before putting things into use.
The trigger has the following outputs you can use as inputs to steps further along the flow.
|List of targeted recipients. Recipients are set by adding a recipients query parameter to the trigger URL.|
|Signal Mode||Determines the path the flow will take, based on the value of the State parameter.|
|Signal ID||Key or identifier used to terminate or correlate signals.|
|Image URL||Direct link to a graph of recent metrics.|
|Message||Message associated with the Grafana rule.|
|Rule ID||ID associated with the Grafana rule.|
|Rule Name||Name of the rule that triggered the notification.|
|Rule URL||Direct link to the rule in Grafana.|
|State||State of the rule in Grafana.|
|Title||Title of the notification as provided by Grafana.|
|Raw Request||JSON representation of the request. You can parse the raw request if you need additional details beyond the standard outputs.|