I used https://github.com/adnanh/webhook to create webhook receiver. I can 
trigger the endpoints manually from terminal or through browser and it 
works alright as expected. But alertmanager webhook can not trigger the 
endpoint when alert is firing and throws the following error - 

caller=notify.go:732 level=warn component=dispatcher receiver=webhook 
integration=webhook[0] msg="Notify attempt failed, will retry later" 
attempts=1 err="unexpected status code 502: 
http://slc14poa.us.oracle.com:9000/hooks/try";

caller=dispatch.go:354 level=error component=dispatcher msg="Notify for 
alerts failed" num_alerts=1 err="webhook/webhook[0]: notify retry canceled 
after 7 attempts: unexpected status code 502: 
http://slc14poa.us.oracle.com:9000/hooks/try";



   - *alertmanager.yml  -*


global:
  resolve_timeout: 5m
  slack_api_url: <>
  http_config:
    proxy_url: <>
route:
  group_by: ['alertname']
  group_wait: 10s
  group_interval: 10s
  repeat_interval: 1h
  receiver: 'slackandemail'

  routes:
  - receiver: 'webhook'
    matchers:
      - alertname = CPU usage high
receivers:
- name: 'slackandemail'
  slack_configs:
  - channel: '#channel'
    title: '{{ template "custom_title" . }}'
    text: '{{ template "custom_slack_message" . }}'
- name: 'webhook'
  webhook_configs:
  - url: "http://<>:9000/hooks/try"
inhibit_rules:
  - source_match:
      severity: 'critical'
    target_match:
      severity: 'warning'
    equal: ['alertname', 'dev', 'instance']
templates:
- notifications.tmpl


   - *alertmanager version -*

alertmanager, version 0.24.0 (branch: HEAD, revision: 
f484b17fa3c583ed1b2c8bbcec20ba1db2aa5f11)
  build user:       <>
  build date:       20220325-09:31:33
  go version:       go1.17.8
  platform:         linux/amd64


   - *prometheus version - *


prometheus, version 2.37.0 (branch: HEAD, revision: 
b41e0750abf5cc18d8233161560731de05199330)
  build user:       <>
  build date:       20220714-15:13:18
  go version:       go1.18.4
  platform:         linux/amd64


   - *"hooks.yml"*

- id: try
  execute-command: "try.sh"
  command-working-directory: "."

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/301ddc51-8942-4ffa-9692-2c662c13b2d2n%40googlegroups.com.

Reply via email to