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{
|
||||
VSendResolved: false,
|
||||
},
|
||||
Color: `{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`,
|
||||
Username: `{{ template "slack.default.username" . }}`,
|
||||
Title: `{{ template "slack.default.title" . }}`,
|
||||
TitleLink: `{{ template "slack.default.titlelink" . }}`,
|
||||
IconEmoji: `{{ template "slack.default.iconemoji" . }}`,
|
||||
IconURL: `{{ template "slack.default.iconurl" . }}`,
|
||||
Pretext: `{{ template "slack.default.pretext" . }}`,
|
||||
Text: `{{ template "slack.default.text" . }}`,
|
||||
Fallback: `{{ template "slack.default.fallback" . }}`,
|
||||
Footer: `{{ template "slack.default.footer" . }}`,
|
||||
Color: `{{ if eq .Status "firing" }}danger{{ else }}good{{ end }}`,
|
||||
Username: `{{ template "slack.default.username" . }}`,
|
||||
Title: `{{ template "slack.default.title" . }}`,
|
||||
TitleLink: `{{ template "slack.default.titlelink" . }}`,
|
||||
IconEmoji: `{{ template "slack.default.iconemoji" . }}`,
|
||||
IconURL: `{{ template "slack.default.iconurl" . }}`,
|
||||
Pretext: `{{ template "slack.default.pretext" . }}`,
|
||||
Text: `{{ template "slack.default.text" . }}`,
|
||||
Fallback: `{{ template "slack.default.fallback" . }}`,
|
||||
CallbackID: `{{ template "slack.default.callbackid" . }}`,
|
||||
Footer: `{{ template "slack.default.footer" . }}`,
|
||||
}
|
||||
|
||||
// DefaultHipchatConfig defines default values for Hipchat configurations.
|
||||
|
@ -319,6 +320,7 @@ type SlackConfig struct {
|
|||
ShortFields bool `yaml:"short_fields,omitempty" json:"short_fields,omitempty"`
|
||||
Footer string `yaml:"footer,omitempty" json:"footer,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"`
|
||||
IconURL string `yaml:"icon_url,omitempty" json:"icon_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.
|
||||
type slackAttachment struct {
|
||||
Title string `json:"title,omitempty"`
|
||||
TitleLink string `json:"title_link,omitempty"`
|
||||
Pretext string `json:"pretext,omitempty"`
|
||||
Text string `json:"text"`
|
||||
Fallback string `json:"fallback"`
|
||||
Fields []config.SlackField `json:"fields,omitempty"`
|
||||
Actions []config.SlackAction `json:"actions,omitempty"`
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
ThumbURL string `json:"thumb_url,omitempty"`
|
||||
Footer string `json:"footer"`
|
||||
Title string `json:"title,omitempty"`
|
||||
TitleLink string `json:"title_link,omitempty"`
|
||||
Pretext string `json:"pretext,omitempty"`
|
||||
Text string `json:"text"`
|
||||
Fallback string `json:"fallback"`
|
||||
CallbackID string `json:"callback_id"`
|
||||
Fields []config.SlackField `json:"fields,omitempty"`
|
||||
Actions []config.SlackAction `json:"actions,omitempty"`
|
||||
ImageURL string `json:"image_url,omitempty"`
|
||||
ThumbURL string `json:"thumb_url,omitempty"`
|
||||
Footer string `json:"footer"`
|
||||
|
||||
Color string `json:"color,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{
|
||||
Title: tmplText(n.conf.Title),
|
||||
TitleLink: tmplText(n.conf.TitleLink),
|
||||
Pretext: tmplText(n.conf.Pretext),
|
||||
Text: tmplText(n.conf.Text),
|
||||
Fallback: tmplText(n.conf.Fallback),
|
||||
ImageURL: tmplText(n.conf.ImageURL),
|
||||
ThumbURL: tmplText(n.conf.ThumbURL),
|
||||
Footer: tmplText(n.conf.Footer),
|
||||
Color: tmplText(n.conf.Color),
|
||||
MrkdwnIn: []string{"fallback", "pretext", "text"},
|
||||
Title: tmplText(n.conf.Title),
|
||||
TitleLink: tmplText(n.conf.TitleLink),
|
||||
Pretext: tmplText(n.conf.Pretext),
|
||||
Text: tmplText(n.conf.Text),
|
||||
Fallback: tmplText(n.conf.Fallback),
|
||||
CallbackID: tmplText(n.conf.CallbackID),
|
||||
ImageURL: tmplText(n.conf.ImageURL),
|
||||
ThumbURL: tmplText(n.conf.ThumbURL),
|
||||
Footer: tmplText(n.conf.Footer),
|
||||
Color: tmplText(n.conf.Color),
|
||||
MrkdwnIn: []string{"fallback", "pretext", "text"},
|
||||
}
|
||||
|
||||
var numFields = len(n.conf.Fields)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
{{ define "slack.default.title" }}{{ template "__subject" . }}{{ end }}
|
||||
{{ define "slack.default.username" }}{{ template "__alertmanager" . }}{{ 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.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
|
||||
{{ define "slack.default.iconemoji" }}{{ end }}
|
||||
|
|
Loading…
Reference in New Issue