We use Prometheus metrics as datasource for Grafana Alerting on a Java/Spring Boot application which consumes Kafka Messages. I’ve created an alert that triggers when the rate of Kafka exceptions is above a certain level.
I’d like to create a webhook contact point that uses the instance from the alert as the webhook URL; such to instruct our application to stop the consumption of messages.
How can i get hold of the instance variable in the webhook configuration?
In the image below i use a hardcoded IP adres, but since this is in a cluster i’d like to use the instance variable from the alert.
If tried some of the templating syntax ( {{}}
) to see if the instance variable is available, but there i get
template::1:function “instance” not defined.
(This appears to suggest i need to create a function for this: ìs that the way to go, and where do i find some pointers on that?)
Webhook field in contact point definition:
1
By now i’ve learned that
https://{{index .CommonLabels “instance”}}/kafkacontrol
appears to do the job.
(and that what i called ‘variable’ is named ‘label’).