fix silence matchers
This commit is contained in:
parent
2e2db345da
commit
209ba167ad
1 changed files with 5 additions and 2 deletions
|
@ -52,14 +52,17 @@ class AlertmanagerClient:
|
|||
|
||||
self._match_alert(alert, matchers)
|
||||
|
||||
labels = alert["labels"]
|
||||
silence_matchers = [
|
||||
{"name": label, "value": value, "isRegex": False, "isEqual": True}
|
||||
for label, value in alert["labels"].items()
|
||||
]
|
||||
start_time = datetime.now()
|
||||
duration_seconds = pytimeparse2.parse(duration)
|
||||
duration_delta = timedelta(seconds=duration_seconds)
|
||||
end_time = start_time + duration_delta
|
||||
|
||||
silence = {
|
||||
"matchers": labels,
|
||||
"matchers": silence_matchers,
|
||||
"startsAt": start_time.isoformat(),
|
||||
"endsAt": end_time.isoformat(),
|
||||
"createdBy": user,
|
||||
|
|
Loading…
Add table
Reference in a new issue