prometheus / prometheus/alertmanager
Alerts are not closed at Opsgenie receiver
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.6k
- Forks
- 2.5k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 61
Description
What did you do?
I am using AlertManager to send alerts to Opsgenie. When the alert is resolved on backend (Prometheus/Alertmanager), I just receive another email about the alert but it remains open in Opsgenie.
What did you expect to see?
Alert being marked as closed in Opsgenie when it gets resolved in Prometheus
What did you see instead? Under which circumstances?
I just get notified by email about the alert, just like in the case when alert gets created.
Environment
-
System information:
Darwin 22.4.0 arm64 -
Alertmanager version:
v0.25.0 -
Prometheus version:
v2.37.2 -
Alertmanager configuration file:
route:
receiver: opsgenie-dispatcher
routes:
- matchers:
- send_to=opsgenie
receiver: opsgenie-dispatcher
repeat_interval: 6h
group_interval: 1m
group_wait: 1m
group_by: ['team', 'environment', 'alertname']
receivers:
- name: opsgenie-dispatcher
opsgenie_configs:
- send_resolved: true
api_url: https://api.opsgenie.com
api_key: <API_KEY>
message: '{{ .CommonLabels.alertname }}'
description: '{{ template "opsgenie.description" . }}'
priority: '{{ .CommonLabels.priority }}'
responders:
- type: team
name: '{{ .CommonLabels.team }}'
templates:
- ./template/*.tmpl
- Prometheus configuration file:
global:
scrape_interval: 10s
scrape_timeout: 10s
rule_files:
- alert.yml
alerting:
alertmanagers:
- scheme: http
static_configs:
- targets: [ 'alertmanager:9093' ]
scrape_configs:
- job_name: services
metrics_path: /metrics
static_configs:
- targets:
- 'prometheus:9090'
- 'idonotexists:564'
alert.yml
groups:
- name: DemoAlerts
rules:
- alert: InstanceDown
expr: up{job="services"} == 0
for: 0m
labels:
send_to: opsgenie
priority: "P2"
team: test-prometheus-integration
annotations:
description: "Instance {{$labels.instance}} is down for over 1m"
- Logs:
When alert is created:
ts=2023-06-06T10:03:16.884Z caller=dispatch.go:163 level=debug component=dispatcher msg="Received alert" alert=InstanceDown[c2e4e72][active]
ts=2023-06-06T10:04:16.884Z caller=dispatch.go:515 level=debug component=dispatcher aggrGroup="{}/{send_to=\"opsgenie\"}:{alertname=\"InstanceDown\", team=\"test-prometheus-integration\"}" msg=flushing alerts=[InstanceDown[c2e4e72][active]]
ts=2023-06-06T10:04:16.885Z caller=opsgenie.go:139 level=debug integration=opsgenie alert="{}/{send_to=\"opsgenie\"}:{alertname=\"InstanceDown\", team=\"test-prometheus-integration\"}"
ts=2023-06-06T10:04:17.315Z caller=notify.go:743 level=debug component=dispatcher receiver=opsgenie-dispatcher integration=opsgenie[0] msg="Notify success" attempts=1
When alert is resolved:
ts=2023-06-06T10:08:16.881Z caller=dispatch.go:163 level=debug component=dispatcher msg="Received alert" alert=InstanceDown[c2e4e72][resolved]
ts=2023-06-06T10:08:16.885Z caller=dispatch.go:515 level=debug component=dispatcher aggrGroup="{}/{send_to=\"opsgenie\"}:{alertname=\"InstanceDown\", team=\"test-prometheus-integration\"}" msg=flushing alerts=[InstanceDown[c2e4e72][resolved]]
ts=2023-06-06T10:08:16.885Z caller=opsgenie.go:139 level=debug integration=opsgenie alert="{}/{send_to=\"opsgenie\"}:{alertname=\"InstanceDown\", team=\"test-prometheus-integration\"}"
ts=2023-06-06T10:08:17.069Z caller=notify.go:743 level=debug component=dispatcher receiver=opsgenie-dispatcher integration=opsgenie[0] msg="Notify success" attempts=1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Opsgenie integration entry point named in the logs, opsgenie.go, and reproduce the report using the supplied Alertmanager configuration and resolved-alert logs. Trace how resolved notifications are sent and verify that the corresponding Opsgenie alert is marked closed rather than receiving only another email.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100