Grafana Webhook

Hi all,

Has someone used webhooks in grafana for alerting? and can someone explain me how it works and How we create custom endpoints?

Thanks,
Shoaib

It is a simple concept. Grafana will call your endpoint when there is an alert and send a json object with alert data. The json object is shown in the docs:

http://docs.grafana.org/alerting/notifications/#webhook

Where are you getting stuck?

Everything is cool with webhook notification channel.
I was able to trigger my Jenkins job successfully with it. Now automation cycle nearly completed.

@daniellee ,
how we can send json data with post method…here is no any options to pass json data…& how can we identify particular dashboard dynamically when end point called?

The json object is defined in the docs (same link as above). It can’t be customized.

It is the other way round. The webhook posts the data to your http endpoint when an alert is fired.

When the webhook makes a POST http call to your endpoint, the json object that is posted to your endpoint has a ruleUrl field with a link to the dashboard.

Not being able to customize what we pass to the remote endpoint seems to be a serious flaw. This was billed as being a feature where we could easily integrate Grafana with other solutions but it sounds like the Dev team expects users to code their application around Grafana and how Grafana passes it’s data rather than having it open where we can specify the data we want to pass to the external application. Not going to integrate with very many things this way when it comes to sending alert notifications via webhook.

1 Like

you can actually put a json object in the message. there are also ‘tags’ which support a general name / value association. and the metrics and values that triggered the alert are available in the evalMatches[] part of the webhook payload.