-
Notifications
You must be signed in to change notification settings - Fork 88
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
prom2teams support for alertmanager 0.21.0 #189
Comments
As an example, it fails to process truncatedAlerts - It's entirely probable this will be an issue again in the future. The service should ensure that the bare minimum is there for the alert, process that, and ignore any extra fields unless configured to do something with them. It should not crash just because the JSON changes (unless of course it's missing a critical field). {
"receiver": "teams",
"status": "firing",
"alerts": [
{
"status": "firing",
"labels": {
"alertname": "monitor_service_down",
"instance": "nodeexporter:9100",
"job": "nodeexporter",
"severity": "critical"
},
"annotations": {
"description": "Service nodeexporter:9100 is down.",
"summary": "Monitor service non-operational"
},
"startsAt": "2020-06-29T08:38:40.873441835Z",
"endsAt": "0001-01-01T00:00:00Z",
"generatorURL": "http://dca7eb0ee6bd:9090/graph?g0.expr=up+%3D%3D+0&g0.tab=1",
"fingerprint": "63d160a31e26eeb5"
}
],
"groupLabels": {},
"commonLabels": {
"alertname": "monitor_service_down",
"instance": "nodeexporter:9100",
"job": "nodeexporter",
"severity": "critical"
},
"commonAnnotations": {
"description": "Service nodeexporter:9100 is down.",
"summary": "Monitor service non-operational"
},
"externalURL": "http://ca5a0c57a917:9093",
"version": "4",
"groupKey": "{}:{}",
"truncatedAlerts": 0
} |
#189 Fixed handling of additional json properties of alertmanager 0.21.0.
Hi all, I´ve published a 2.5.6 version including your changes. Could you check if everything is OK? |
Unfortunately no:
|
@dortegau @marcinbojko sorry for the issues, seems I forgot an Import.
also, from what I can understand there is no test starting the whole app? That might be usefull too. Or some hints in the README how to build and run locally. |
Can anyone merge this or help me build a runnable image? Please? |
solved it like this:
--- prometheus/message_schema.py
+++ prometheus/message_schema.py
@@ -5,6 +5,8 @@ log = logging.getLogger('prom2teams')
class MessageSchema(Schema):
+ class Meta:
+ unknown = EXCLUDE
def __init__(self, exclude_fields=tuple(), exclude_annotations=tuple()):
super().__init__()
@@ -68,7 +70,8 @@ class AlertSchema(Schema):
endsAt = fields.DateTime()
generatorURL = fields.Str()
fingerprint = fields.Str()
-
+ class Meta:
+ unknown = EXCLUDE
class LabelSchema(Schema):
alertname = fields.Str(default='unknown', missing='unknown')
FROM idealista/prom2teams:2.5.5
RUN pip install pypatch
COPY fix.patch /fix.patch
RUN pypatch apply /fix.patch prom2teams and then |
Honestly, until this gets ironed out I just bumped my Alertmanager version back to 0.20.0 and it's working just fine. Unless you have a specific dependency on something in 0.21.0 it's a painless change. |
tested with image 2.5.7 - still same error |
Fixed in #210 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Prerequisites
Description
[Description of the issue]
prom2teams in version 2.5.5 doesn't support alertmanager in version 0.21.
Steps to Reproduce
run prom2teams in v 2.5.5 and alertmanager in version 0.21.x
send notification
Expected behavior: [What you expect to happen]
ignore unknown fields, parse and send notification
Actual behavior: [What actually happens]
crash
Reproduces how often: [What percentage of the time does it reproduce?]
always
Versions
The version/s you notice the behavior.
2.5.4/2.5.5
Additional Information
Any additional information, configuration or data that might be necessary to reproduce the issue.
The text was updated successfully, but these errors were encountered: