-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow templating in the webhook URL #684
Comments
The webhook URL is not a templateable field. Instead the webhook notifier sends all metadata in the request body, as outlined in https://prometheus.io/docs/alerting/configuration/#<webhook_config>. You can grab the labels from there in your webhook implementation. Closing, as this is hopefully answered. If not, please ask questions on the users mailing list instead of opening an issue: https://prometheus.io/community/ |
Thanks. Don't you think its a enhancement. |
I can reopen this as a feature request, but it started out as a question. |
This wouldn't make sense feature wise. The webhook is meant to work in exactly one way, with the other end specifically designed to accept what we send. The other end already has all the information it needs. |
That's what I thought too. Confirmed then... |
Like other config where url used that all are customised template. Why not webhook? and can't be a static all time. Let it be open for further discussion.. |
@prasenforu The reasoning here goes:
|
OK. Let me explain why ? I am using prometheus in containers platform (kubernetes) where things are changing very dynamically. I do agree your point. Can you please suggest any alternative solution where I can pass labels in that url. Otherwise I have to write for each conrainer separate webhook which is not a good idea. Basically I want to make global. Anyway thanks for your continuous support. |
Uhm, write a webhook that does this and sends out the requests in the format you need. |
Finally able to setup webhook without templating webhook url. Thanks all to rethink on this. Bydefault webhook resolve option is true. Is that mean when it resolve it will fire same webhook. Is that understanding correct? |
Yes.
…On Fri, Apr 7, 2017 at 3:34 PM, prasenforu ***@***.***> wrote:
Finally able to setup webhook without templating webhook url.
Thanks all to rethink on this.
Bydefault webhook resolve option is true.
Is that mean when it resolve it will fire same webhook.
Is that understanding correct?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#684 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAg1mIKX77ECyF5wnB96WNC1xACQxkpqks5rtjtzgaJpZM4MxXAt>
.
|
I have small question. Lets say we need to call API endpoint based on alert. If alert is about a particular docker service. How can we pass the service name as part of webhook url? I am able to call the endpoint with hardcoded service name. http://url/api/coreservice/scaleup/. And configure the url in alertmanager.yml. webhook_configs: How can we get he service name? Can we use {{.Labels.container_label_com_docker_swarm_service_name}} ? |
@rajkiran616 Please don't put support requests on closed issues. The Prometheus users list is the best place for such questions. |
@brian-brazil If we allow templating in url we can use opegenie to track heatbeats (via DeadmanSwitch) in case of alerts coming from multiple clusters. Ops genie will create seperate heartbeat for each cluster. route: receivers:
|
We allow users to specify their slack, email, and pagerduty from the alert file itself:
These get expanded in the alertmanager config, e.g.
That way, team-specific configs stay out of the alertmanager config. I prefer to have teams put their own configs in their own files, and I (as a sysadmin/ops/whatever) maintain the alertmanager config. The one exception I've run into so far is that webhooks aren't templateable, so I need to allow people to write to the alertmanager config. This describes a usecase where I'd be happy if webhooks became templateable. |
+1, need templating in webhook URL for OpsGenie HeartBeat |
+1, this would be the only way (i can think of) to make |
I have another example where templatable urls can be usefull: |
@nehalraf Have you found a solution for templating opsgenie's heartbeats? |
Dear @brian-brazil |
Alertmanager version: 0.5.1
My alert configure as follows ...
webhooks setup as follows ..
In webhook server logs I am getting data as follows.
not as a data, its coming as a complete variable.
So I am not able to pass the value/data "labels.kubernetes_pod_name" & "labels.container_label_io_kubernetes_pod_namespace" in webhook_configs "email-n-webhookup"
Statically it worked as per "email-n-webhookdn"
I think its supported for Email as per https://www.robustperception.io/using-labels-to-direct-email-notifications/
not sure if I can use it in webhook as well ......
Please help ....
The text was updated successfully, but these errors were encountered: