mirror of
https://github.com/prometheus/alertmanager
synced 2025-01-12 09:10:13 +00:00
Add support for overriding the icon_url slack parameter
This commit is contained in:
parent
22b4d74f7e
commit
c5d1c48610
@ -65,6 +65,7 @@ var (
|
||||
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" . }}`,
|
||||
@ -204,6 +205,7 @@ type SlackConfig struct {
|
||||
Text string `yaml:"text"`
|
||||
Fallback string `yaml:"fallback"`
|
||||
IconEmoji string `yaml:"icon_emoji"`
|
||||
IconURL string `yaml:"icon_url"`
|
||||
|
||||
// Catches all undefined fields and must be empty after parsing.
|
||||
XXX map[string]interface{} `yaml:",inline"`
|
||||
|
@ -463,6 +463,7 @@ type slackReq struct {
|
||||
Channel string `json:"channel,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
IconEmoji string `json:"icon_emoji,omitempty"`
|
||||
IconURL string `json:"icon_url,omitempty"`
|
||||
Attachments []slackAttachment `json:"attachments"`
|
||||
}
|
||||
|
||||
@ -506,6 +507,7 @@ func (n *Slack) Notify(ctx context.Context, as ...*types.Alert) error {
|
||||
Channel: tmplText(n.conf.Channel),
|
||||
Username: tmplText(n.conf.Username),
|
||||
IconEmoji: tmplText(n.conf.IconEmoji),
|
||||
IconURL: tmplText(n.conf.IconURL),
|
||||
Attachments: []slackAttachment{*attachment},
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -18,6 +18,7 @@
|
||||
{{ define "slack.default.pretext" }}{{ end }}
|
||||
{{ define "slack.default.titlelink" }}{{ template "__alertmanagerURL" . }}{{ end }}
|
||||
{{ define "slack.default.iconemoji" }}{{ end }}
|
||||
{{ define "slack.default.iconurl" }}{{ end }}
|
||||
{{ define "slack.default.text" }}{{ end }}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user