-
Notifications
You must be signed in to change notification settings - Fork 490
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
Feature Request: Access to {{ .Duration }} in alert message template #1605
Comments
@thuck What is |
@desa for the AlertNode there is some predefined fields:
This is extract from here: https://docs.influxdata.com/kapacitor/v1.3//nodes/alert_node/ If you check the json generated by the alert there is the field for duration there:
So, as far as I can understand, the Duration here should be the duration that we have on the json, that's is related to the time that the alert is in that state; but if you try to use {{ .Duration }} as you would use {{ .Level }} it do not find it. So this works:
But this do not:
|
From the documentation it looks like the following are available in the message template http://docs.influxdata.com/kapacitor/v1.3/nodes/alert_node/#message
|
Hmm weird, it should actually be available https://github.com/influxdata/kapacitor/blob/master/alert/types.go#L100
|
Wait, actually I'm wrong https://github.com/influxdata/kapacitor/blob/master/alert.go#L1035-L1049
I'm going to change this to a Feature Request. |
Great, thanks |
@thuck if you're interested, it'd be a pretty easy contribution. Essentially it'd be Step 1https://github.com/influxdata/kapacitor/blob/master/alert.go#L1035-L1049 Step 2https://github.com/influxdata/kapacitor/blob/master/alert.go#L698 Step 3Write tests to verify the behavior. |
@desa yep, I'll give a try on this, looks simple to implement |
Includes the .Duration for the Message and Details on alert #1605
Maybe I'm missing something, but If I try to use {{ .Duration }} as part of the alarm message I have an error:
Taking a look on the source code of the alert.go; I cannot find duration as part of the
renderMessageAndDetails
Am I missing something or this is not implemented? Also if implemented how could I change this from nanoseconds to hours or minutes.
The text was updated successfully, but these errors were encountered: