Add support for Teams and Tags to OpsGenie notifier

Add Teams and Tags templated strings to OpsGenieConfig. Output must be comma-separated values.
This commit is contained in:
Seb Dijols 2016-03-10 19:30:21 +00:00
parent 04fbfb9a65
commit 7d512eba56
2 changed files with 6 additions and 0 deletions

View File

@ -280,6 +280,8 @@ type OpsGenieConfig struct {
Description string `yaml:"description"` Description string `yaml:"description"`
Source string `yaml:"source"` Source string `yaml:"source"`
Details map[string]string `yaml:"details"` Details map[string]string `yaml:"details"`
Teams string `yaml:"teams"`
Tags string `yaml:"tags"`
// Catches all undefined fields and must be empty after parsing. // Catches all undefined fields and must be empty after parsing.
XXX map[string]interface{} `yaml:",inline"` XXX map[string]interface{} `yaml:",inline"`

View File

@ -620,6 +620,8 @@ type opsGenieCreateMessage struct {
Message string `json:"message"` Message string `json:"message"`
Details map[string]string `json:"details"` Details map[string]string `json:"details"`
Source string `json:"source"` Source string `json:"source"`
Teams string `json:"teams,omitempty"`
Tags string `json:"tags,omitempty"`
} }
type opsGenieCloseMessage struct { type opsGenieCloseMessage struct {
@ -665,6 +667,8 @@ func (n *OpsGenie) Notify(ctx context.Context, as ...*types.Alert) error {
Message: tmpl(n.conf.Description), Message: tmpl(n.conf.Description),
Details: details, Details: details,
Source: tmpl(n.conf.Source), Source: tmpl(n.conf.Source),
Teams: tmpl(n.conf.Teams),
Tags: tmpl(n.conf.Tags),
} }
} }
if err != nil { if err != nil {