Slack notifier missing callback_id parameter (#1592)
* fix callback id in slack attachments Signed-off-by: Arno Uhlig <arno.uhlig@sap.com>
This commit is contained in:
parent
f297445b88
commit
c38ac84a6d
File diff suppressed because one or more lines are too long
|
@ -64,16 +64,17 @@ var (
|
||||||
NotifierConfig: NotifierConfig{
|
NotifierConfig: NotifierConfig{
|
||||||
VSendResolved: false,
|
VSendResolved: false,
|
||||||
},
|
},
|
||||||
Color: `{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`,
|
Color: `{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`,
|
||||||
Username: `{{ template "slack.default.username" . }}`,
|
Username: `{{ template "slack.default.username" . }}`,
|
||||||
Title: `{{ template "slack.default.title" . }}`,
|
Title: `{{ template "slack.default.title" . }}`,
|
||||||
TitleLink: `{{ template "slack.default.titlelink" . }}`,
|
TitleLink: `{{ template "slack.default.titlelink" . }}`,
|
||||||
IconEmoji: `{{ template "slack.default.iconemoji" . }}`,
|
IconEmoji: `{{ template "slack.default.iconemoji" . }}`,
|
||||||
IconURL: `{{ template "slack.default.iconurl" . }}`,
|
IconURL: `{{ template "slack.default.iconurl" . }}`,
|
||||||
Pretext: `{{ template "slack.default.pretext" . }}`,
|
Pretext: `{{ template "slack.default.pretext" . }}`,
|
||||||
Text: `{{ template "slack.default.text" . }}`,
|
Text: `{{ template "slack.default.text" . }}`,
|
||||||
Fallback: `{{ template "slack.default.fallback" . }}`,
|
Fallback: `{{ template "slack.default.fallback" . }}`,
|
||||||
Footer: `{{ template "slack.default.footer" . }}`,
|
CallbackID: `{{ template "slack.default.callbackid" . }}`,
|
||||||
|
Footer: `{{ template "slack.default.footer" . }}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultHipchatConfig defines default values for Hipchat configurations.
|
// DefaultHipchatConfig defines default values for Hipchat configurations.
|
||||||
|
@ -319,6 +320,7 @@ type SlackConfig struct {
|
||||||
ShortFields bool `yaml:"short_fields,omitempty" json:"short_fields,omitempty"`
|
ShortFields bool `yaml:"short_fields,omitempty" json:"short_fields,omitempty"`
|
||||||
Footer string `yaml:"footer,omitempty" json:"footer,omitempty"`
|
Footer string `yaml:"footer,omitempty" json:"footer,omitempty"`
|
||||||
Fallback string `yaml:"fallback,omitempty" json:"fallback,omitempty"`
|
Fallback string `yaml:"fallback,omitempty" json:"fallback,omitempty"`
|
||||||
|
CallbackID string `yaml:"callback_id,omitempty" json:"callback_id,omitempty"`
|
||||||
IconEmoji string `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
|
IconEmoji string `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"`
|
||||||
IconURL string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
|
IconURL string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"`
|
||||||
ImageURL string `yaml:"image_url,omitempty" json:"image_url,omitempty"`
|
ImageURL string `yaml:"image_url,omitempty" json:"image_url,omitempty"`
|
||||||
|
|
|
@ -706,16 +706,17 @@ type slackReq struct {
|
||||||
|
|
||||||
// slackAttachment is used to display a richly-formatted message block.
|
// slackAttachment is used to display a richly-formatted message block.
|
||||||
type slackAttachment struct {
|
type slackAttachment struct {
|
||||||
Title string `json:"title,omitempty"`
|
Title string `json:"title,omitempty"`
|
||||||
TitleLink string `json:"title_link,omitempty"`
|
TitleLink string `json:"title_link,omitempty"`
|
||||||
Pretext string `json:"pretext,omitempty"`
|
Pretext string `json:"pretext,omitempty"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
Fallback string `json:"fallback"`
|
Fallback string `json:"fallback"`
|
||||||
Fields []config.SlackField `json:"fields,omitempty"`
|
CallbackID string `json:"callback_id"`
|
||||||
Actions []config.SlackAction `json:"actions,omitempty"`
|
Fields []config.SlackField `json:"fields,omitempty"`
|
||||||
ImageURL string `json:"image_url,omitempty"`
|
Actions []config.SlackAction `json:"actions,omitempty"`
|
||||||
ThumbURL string `json:"thumb_url,omitempty"`
|
ImageURL string `json:"image_url,omitempty"`
|
||||||
Footer string `json:"footer"`
|
ThumbURL string `json:"thumb_url,omitempty"`
|
||||||
|
Footer string `json:"footer"`
|
||||||
|
|
||||||
Color string `json:"color,omitempty"`
|
Color string `json:"color,omitempty"`
|
||||||
MrkdwnIn []string `json:"mrkdwn_in,omitempty"`
|
MrkdwnIn []string `json:"mrkdwn_in,omitempty"`
|
||||||
|
@ -730,16 +731,17 @@ func (n *Slack) Notify(ctx context.Context, as ...*types.Alert) (bool, error) {
|
||||||
)
|
)
|
||||||
|
|
||||||
attachment := &slackAttachment{
|
attachment := &slackAttachment{
|
||||||
Title: tmplText(n.conf.Title),
|
Title: tmplText(n.conf.Title),
|
||||||
TitleLink: tmplText(n.conf.TitleLink),
|
TitleLink: tmplText(n.conf.TitleLink),
|
||||||
Pretext: tmplText(n.conf.Pretext),
|
Pretext: tmplText(n.conf.Pretext),
|
||||||
Text: tmplText(n.conf.Text),
|
Text: tmplText(n.conf.Text),
|
||||||
Fallback: tmplText(n.conf.Fallback),
|
Fallback: tmplText(n.conf.Fallback),
|
||||||
ImageURL: tmplText(n.conf.ImageURL),
|
CallbackID: tmplText(n.conf.CallbackID),
|
||||||
ThumbURL: tmplText(n.conf.ThumbURL),
|
ImageURL: tmplText(n.conf.ImageURL),
|
||||||
Footer: tmplText(n.conf.Footer),
|
ThumbURL: tmplText(n.conf.ThumbURL),
|
||||||
Color: tmplText(n.conf.Color),
|
Footer: tmplText(n.conf.Footer),
|
||||||
MrkdwnIn: []string{"fallback", "pretext", "text"},
|
Color: tmplText(n.conf.Color),
|
||||||
|
MrkdwnIn: []string{"fallback", "pretext", "text"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var numFields = len(n.conf.Fields)
|
var numFields = len(n.conf.Fields)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
{{ define "slack.default.title" }}{{ template "__subject" . }}{{ end }}
|
{{ define "slack.default.title" }}{{ template "__subject" . }}{{ end }}
|
||||||
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
|
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ end }}
|
||||||
{{ define "slack.default.fallback" }}{{ template "slack.default.title" . }} | {{ template "slack.default.titlelink" . }}{{ end }}
|
{{ define "slack.default.fallback" }}{{ template "slack.default.title" . }} | {{ template "slack.default.titlelink" . }}{{ end }}
|
||||||
|
{{ define "slack.default.callbackid" }}{{ end }}
|
||||||
{{ define "slack.default.pretext" }}{{ end }}
|
{{ define "slack.default.pretext" }}{{ end }}
|
||||||
{{ define "slack.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
|
{{ define "slack.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
|
||||||
{{ define "slack.default.iconemoji" }}{{ end }}
|
{{ define "slack.default.iconemoji" }}{{ end }}
|
||||||
|
|
Loading…
Reference in New Issue