-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Alert severity not correctly set on PagerDuty Alert #1211
Comments
Severity is set in - name: CTeam-pagerduty-alert
pagerduty_configs:
- send_resolved: true
routing_key: <secret>
severity: warning |
Sorry, this was one of the tests I've done. If you remove it, it will have the behavior I described. Its not passing on the severity and I can't find in the documentation how to do it. |
Ah, I misunderstood, sorry about that. As it is now, the severity can only be defined statically in the receiver. To pass on the severity in the label, the code needs to be slightly updated here: Line 509 in 6a3dfaf
I would recommend against this, as if an alert group has mixed severity labels (one is severe, one is warning), then that common label isn't there for templating. I'm not sure how you have your grouping configured, though. I would recommend in your routes defining a match on That having been said, if you want to add templating to the severity in the link above, that would be fine by me (although I would still recommend being explicit). |
Thanks for reopening. So in my use of AM, we have around 10 teams and many more services. Each team will decide on the severity of an alert based on the type of problem and the environment in which the problem is happening. Also, PagerDuty makes use of the Severity to define what is the urgency of a alert and with that decide how to contact on call engineers. So in my opinion it would be very useful to have a way to pass the severity configured in the alert directly to PagerDuty, even if that is not the default behavior. Looks like that is the alternative you suggested and I'm very much in favor of it. Creating routing rules for all teams I have and for all four valid seventies in PagerDuty (Info, Warning, Error and Critical) will be a little bit messy. Still, looks like that is the alternative I have for now. Also, I think offering a template for other fields provided by the PagerDuty API v2, such as Group and Component might be useful, so we can have a more generic configuration file and have information being dynamically set according to what is set in the alert. |
Add template to severity field for PagerDuty API v2.
@stuartnelson3 I went ahead and created the PR with the solution you mentioned in case you agree with integrating it. Also, the routing solution works, still it creates a giant config file. Every team will need to have something like this:
In the end, more templates would make the configuration simpler. |
@stuartnelson3 Please let me know if this is what you are looking for: prometheus/docs#956 |
* Allow templating of Component and Group in PagerDuty v2 Related to #1211 * Add missing PD-CEF field Component
I'm trying to use the templated severity field, but the PD-CEF severity field isn't being passed to PD. Here's my config, am I doing something wrong? I'm running AM 0.15.0-rc.1.
I'm using the same curl request as above. |
Oops, I've corrected service_key to routing_key to use the PD v2 API. AM is now getting "unexpected status code 400" from PD. Hard coding the severity to |
I too am running into issues using labels with severity. Using AM 0.14.0 and Events v2 API. Tried both Output:
Relevant am config as follows:
alert rule from prometheus:
|
What worked for me was ".CommonLabels.severity". We then added this:
Which makes the severity label low case, the PagerDuty API seems to like it more. We then force an alert to be critical in case severity is not set, which I think is a good practice. Full config for reference, where we also added class, component and group, which are fields supported by the pagerduty API.
For reference on PagerDuty fields: https://v2.developer.pagerduty.com/docs/send-an-event-events-api-v2 |
@dbonatto Thanks! |
I have a same issue - I am getting line 35: did not find expected key" This is what I have in my config file
did i set it up all wrong??? |
@kchaitu4 because of yaml indent issue... |
I'm trying to migrate to the PagerDuty API v2. I already changed to use the routing_key in the configuration so that AM would use the API v2. What I can not find how to do is passing on to PagerDuty the severity that is declared as a label in the alert.
What is happening now is that AM is sending a "error" severity to PagerDuty, which looking in the code I could see that is the default behavior when no severity is set.
Not sure if it is a code or documentation issue, would appreciate some help.
Branch: HEAD
BuildDate: 20180112-10:32:46
BuildUser: root@d83981af1d3d
GoVersion: go1.9.2
Revision: fb713f6
Version: 0.13.0
Version 1.8.2
Revision 5211b96d4d1291c3dd1a569f711d3b301b635ecb
Branch HEAD
BuildUser root@1412e937e4ad
BuildDate 20171104-16:09:14
GoVersion go1.9.2
The text was updated successfully, but these errors were encountered: