Renamed from and message options for VictorOps to monitoring_tool and state_message as per the VictorOps documentation (#667)

This commit is contained in:
Conor Broderick 2017-03-24 14:06:39 +00:00 committed by Brian Brazil
parent 1e34f29532
commit b7bea3df5c
3 changed files with 19 additions and 19 deletions

View File

@ -98,9 +98,9 @@ var (
NotifierConfig: NotifierConfig{
VSendResolved: true,
},
MessageType: `CRITICAL`,
StateMessage: `{{ template "victorops.default.message" . }}`,
From: `{{ template "victorops.default.from" . }}`,
MessageType: `CRITICAL`,
StateMessage: `{{ template "victorops.default.state_message" . }}`,
MonitoringTool: `{{ template "victorops.default.monitoring_tool" . }}`,
}
// DefaultPushoverConfig defines default values for Pushover configurations.
@ -321,12 +321,12 @@ func (c *OpsGenieConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
type VictorOpsConfig struct {
NotifierConfig `yaml:",inline" json:",inline"`
APIKey Secret `yaml:"api_key" json:"api_key"`
APIURL string `yaml:"api_url" json:"api_url"`
RoutingKey string `yaml:"routing_key" json:"routing_key"`
MessageType string `yaml:"message_type" json:"message_type"`
StateMessage string `yaml:"message" json:"message"`
From string `yaml:"from" json:"from"`
APIKey Secret `yaml:"api_key" json:"api_key"`
APIURL string `yaml:"api_url" json:"api_url"`
RoutingKey string `yaml:"routing_key" json:"routing_key"`
MessageType string `yaml:"message_type" json:"message_type"`
StateMessage string `yaml:"state_message" json:"state_message"`
MonitoringTool string `yaml:"monitoring_tool" json:"monitoring_tool"`
XXX map[string]interface{} `yaml:",inline" json:"-"`
}

View File

@ -763,10 +763,10 @@ const (
)
type victorOpsMessage struct {
MessageType string `json:"message_type"`
EntityID model.Fingerprint `json:"entity_id"`
StateMessage string `json:"state_message"`
From string `json:"monitoring_tool"`
MessageType string `json:"message_type"`
EntityID model.Fingerprint `json:"entity_id"`
StateMessage string `json:"state_message"`
MonitoringTool string `json:"monitoring_tool"`
}
type victorOpsErrorResponse struct {
@ -805,10 +805,10 @@ func (n *VictorOps) Notify(ctx context.Context, as ...*types.Alert) (bool, error
}
msg := &victorOpsMessage{
MessageType: messageType,
EntityID: key,
StateMessage: tmpl(n.conf.StateMessage),
From: tmpl(n.conf.From),
MessageType: messageType,
EntityID: key,
StateMessage: tmpl(n.conf.StateMessage),
MonitoringTool: tmpl(n.conf.MonitoringTool),
}
if err != nil {

View File

@ -46,8 +46,8 @@ Alerts Resolved:
{{ define "opsgenie.default.source" }}{{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.message" }}{{ template "__subject" . }} | {{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.from" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "victorops.default.state_message" }}{{ template "__subject" . }} | {{ template "__alertmanagerURL" . }}{{ end }}
{{ define "victorops.default.monitoring_tool" }}{{ template "__alertmanager" . }}{{ end }}
{{ define "email.default.subject" }}{{ template "__subject" . }}{{ end }}