{"action":"reopened","issue":{"url":"https://api.github.com/repos/prometheus/alertmanager/issues/684","repository_url":"https://api.github.com/repos/prometheus/alertmanager","labels_url":"https://api.github.com/repos/prometheus/alertmanager/issues/684/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/alertmanager/issues/684/comments","events_url":"https://api.github.com/repos/prometheus/alertmanager/issues/684/events","html_url":"https://github.com/prometheus/alertmanager/issues/684","id":218892146,"number":684,"title":"Using labels in Alertmanager webhook","user":{"login":"prasenforu","id":19322497,"avatar_url":"https://avatars2.githubusercontent.com/u/19322497?v=3","gravatar_id":"","url":"https://api.github.com/users/prasenforu","html_url":"https://github.com/prasenforu","followers_url":"https://api.github.com/users/prasenforu/followers","following_url":"https://api.github.com/users/prasenforu/following{/other_user}","gists_url":"https://api.github.com/users/prasenforu/gists{/gist_id}","starred_url":"https://api.github.com/users/prasenforu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prasenforu/subscriptions","organizations_url":"https://api.github.com/users/prasenforu/orgs","repos_url":"https://api.github.com/users/prasenforu/repos","events_url":"https://api.github.com/users/prasenforu/events{/privacy}","received_events_url":"https://api.github.com/users/prasenforu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-03T10:33:34Z","updated_at":"2017-04-03T16:25:57Z","closed_at":null,"body":"Alertmanager version: 0.5.1\r\n\r\nMy alert configure as follows ...\r\n\r\n```\r\nALERT PoDHighCPUUsage\r\n  IF sum(rate(container_cpu_usage_seconds_total{container_label_io_kubernetes_pod_namespace!=\"\"}[2m])) BY (kubernetes_pod_name, kubernetes_io_hostname, container_label_io_kubernetes_pod_namespace) >= 0.2\r\n  FOR 2m\r\n  LABELS {severity=\"criticalup\"}\r\n  ANNOTATIONS {summary=\"CPU usage of POD {{ $labels.kubernetes_pod_name }} {{ $labels.container_label_io_kubernetes_pod_namespace }} utilization is  >= 0.4 cores (current value: {{ $value }}%)\"}\r\n```\r\nwebhooks setup as follows ..\r\n\r\n```\r\n- name: 'email-n-webhookup'\r\n  email_configs:\r\n  - to: 'mail-id'\r\n    send_resolved: true\r\n\r\n  webhook_configs:\r\n  - url: http://<webhook_ip>:9000/hooks/ose-webhook?in1={{.Labels.container_label_io_kubernetes_pod_namespace}}&in2={{.Labels.kubernetes_pod_name}}&in3=plus\r\n\r\n- name: 'email-n-webhookdn'\r\n  email_configs:\r\n  - to: 'mail-id'\r\n    send_resolved: true\r\n\r\n  webhook_configs:\r\n  - url: http://<webhook_ip>:9000/hooks/ose-webhook?in1=tomi&in2=chat&in3=minus\r\n```\r\n\r\nIn webhook server logs I am getting data as follows.\r\n\r\n```\r\n[webhook] 2017/04/03 10:03:17 2017-04-03T10:03:17Z | 200 |       194.078µs | 172.30.200.104:9000 | POST /hooks/ose-webhook\r\n[webhook] 2017/04/03 10:03:17 executing /etc/webhook/ose.sh (/etc/webhook/ose.sh) with arguments [\"/etc/webhook/ose.sh\" \"{{.labels.container_label_io_kubernetes_pod_namespace}}\" \"{{$labels.kubernetes_pod_name}}\" \"plus\"] and environment [] using /etc/webhook as cwd\r\n```\r\nnot as a data, its coming as a complete variable.\r\n\r\nSo 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\"\r\n\r\nStatically it worked as per \"email-n-webhookdn\"\r\n\r\nI think its supported for Email as per https://www.robustperception.io/using-labels-to-direct-email-notifications/ \r\n\r\nnot sure if I can use it in webhook as well ......\r\n\r\nPlease help ...."}}
{"actor":{"display_login":"juliusv"}}