Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultWebhookConfig defines default values for Webhook configurations. DefaultWebhookConfig = WebhookConfig{ NotifierConfig: NotifierConfig{ VSendResolved: true, }, } // DefaultEmailConfig defines default values for Email configurations. DefaultEmailConfig = EmailConfig{ NotifierConfig: NotifierConfig{ VSendResolved: false, }, HTML: `{{ template "email.default.html" . }}`, } // DefaultEmailSubject defines the default Subject header of an Email. DefaultEmailSubject = `{{ template "email.default.subject" . }}` // DefaultPagerdutyConfig defines default values for PagerDuty configurations. DefaultPagerdutyConfig = PagerdutyConfig{ NotifierConfig: NotifierConfig{ VSendResolved: true, }, Description: `{{ template "pagerduty.default.description" .}}`, Client: `{{ template "pagerduty.default.client" . }}`, ClientURL: `{{ template "pagerduty.default.clientURL" . }}`, Details: map[string]string{ "firing": `{{ template "pagerduty.default.instances" .Alerts.Firing }}`, "resolved": `{{ template "pagerduty.default.instances" .Alerts.Resolved }}`, "num_firing": `{{ .Alerts.Firing | len }}`, "num_resolved": `{{ .Alerts.Resolved | len }}`, }, } // DefaultSlackConfig defines default values for Slack configurations. DefaultSlackConfig = SlackConfig{ 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" . }}`, } // DefaultHipchatConfig defines default values for Hipchat configurations. DefaultHipchatConfig = HipchatConfig{ NotifierConfig: NotifierConfig{ VSendResolved: false, }, Color: `{{ if eq .Status "firing" }}red{{ else }}green{{ end }}`, From: `{{ template "hipchat.default.from" . }}`, Notify: false, Message: `{{ template "hipchat.default.message" . }}`, MessageFormat: `text`, } // DefaultOpsGenieConfig defines default values for OpsGenie configurations. DefaultOpsGenieConfig = OpsGenieConfig{ NotifierConfig: NotifierConfig{ VSendResolved: true, }, Message: `{{ template "opsgenie.default.message" . }}`, Description: `{{ template "opsgenie.default.description" . }}`, Source: `{{ template "opsgenie.default.source" . }}`, } // DefaultVictorOpsConfig defines default values for VictorOps configurations. DefaultVictorOpsConfig = VictorOpsConfig{ NotifierConfig: NotifierConfig{ VSendResolved: true, }, MessageType: `CRITICAL`, StateMessage: `{{ template "victorops.default.state_message" . }}`, MonitoringTool: `{{ template "victorops.default.monitoring_tool" . }}`, } // DefaultPushoverConfig defines default values for Pushover configurations. DefaultPushoverConfig = PushoverConfig{ NotifierConfig: NotifierConfig{ VSendResolved: true, }, Title: `{{ template "pushover.default.title" . }}`, Message: `{{ template "pushover.default.message" . }}`, URL: `{{ template "pushover.default.url" . }}`, Priority: `{{ if eq .Status "firing" }}2{{ else }}0{{ end }}`, Retry: duration(1 * time.Minute), Expire: duration(1 * time.Hour), } )
var DefaultGlobalConfig = GlobalConfig{ ResolveTimeout: model.Duration(5 * time.Minute), SMTPRequireTLS: true, PagerdutyURL: "https://events.pagerduty.com/generic/2010-04-15/create_event.json", HipchatURL: "https://api.hipchat.com/", OpsGenieAPIHost: "https://api.opsgenie.com/", VictorOpsAPIURL: "https://alert.victorops.com/integrations/generic/20131114/alert/", }
DefaultGlobalConfig provides global default values.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Global *GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"` Route *Route `yaml:"route,omitempty" json:"route,omitempty"` InhibitRules []*InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"` Receivers []*Receiver `yaml:"receivers,omitempty" json:"receivers,omitempty"` Templates []string `yaml:"templates" json:"templates"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` // contains filtered or unexported fields }
Config is the top-level configuration for Alertmanager's config files.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type EmailConfig ¶
type EmailConfig struct { NotifierConfig `yaml:",inline" json:",inline"` // Email address to notify. To string `yaml:"to" json:"to"` From string `yaml:"from" json:"from"` Smarthost string `yaml:"smarthost,omitempty" json:"smarthost,omitempty"` AuthUsername string `yaml:"auth_username" json:"auth_username"` AuthPassword Secret `yaml:"auth_password" json:"auth_password"` AuthSecret Secret `yaml:"auth_secret" json:"auth_secret"` AuthIdentity string `yaml:"auth_identity" json:"auth_identity"` Headers map[string]string `yaml:"headers" json:"headers"` HTML string `yaml:"html" json:"html"` RequireTLS *bool `yaml:"require_tls,omitempty" json:"require_tls,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
EmailConfig configures notifications via mail.
func (*EmailConfig) UnmarshalYAML ¶
func (c *EmailConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type GlobalConfig ¶
type GlobalConfig struct { // ResolveTimeout is the time after which an alert is declared resolved // if it has not been updated. ResolveTimeout model.Duration `yaml:"resolve_timeout" json:"resolve_timeout"` SMTPFrom string `yaml:"smtp_from" json:"smtp_from"` SMTPSmarthost string `yaml:"smtp_smarthost" json:"smtp_smarthost"` SMTPAuthUsername string `yaml:"smtp_auth_username" json:"smtp_auth_username"` SMTPAuthPassword Secret `yaml:"smtp_auth_password" json:"smtp_auth_password"` SMTPAuthSecret Secret `yaml:"smtp_auth_secret" json:"smtp_auth_secret"` SMTPAuthIdentity string `yaml:"smtp_auth_identity" json:"smtp_auth_identity"` SMTPRequireTLS bool `yaml:"smtp_require_tls" json:"smtp_require_tls"` SlackAPIURL Secret `yaml:"slack_api_url" json:"slack_api_url"` PagerdutyURL string `yaml:"pagerduty_url" json:"pagerduty_url"` HipchatURL string `yaml:"hipchat_url" json:"hipchat_url"` HipchatAuthToken Secret `yaml:"hipchat_auth_token" json:"hipchat_auth_token"` OpsGenieAPIHost string `yaml:"opsgenie_api_host" json:"opsgenie_api_host"` VictorOpsAPIURL string `yaml:"victorops_api_url" json:"victorops_api_url"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
GlobalConfig defines configuration parameters that are valid globally unless overwritten.
func (*GlobalConfig) UnmarshalYAML ¶
func (c *GlobalConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type HipchatConfig ¶
type HipchatConfig struct { NotifierConfig `yaml:",inline" json:",inline"` APIURL string `yaml:"api_url" json:"api_url"` AuthToken Secret `yaml:"auth_token" json:"auth_token"` RoomID string `yaml:"room_id" json:"room_id"` From string `yaml:"from" json:"from"` Notify bool `yaml:"notify" json:"notify"` Message string `yaml:"message" json:"message"` MessageFormat string `yaml:"message_format" json:"message_format"` Color string `yaml:"color" json:"color"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
HipchatConfig configures notifications via Hipchat.
func (*HipchatConfig) UnmarshalYAML ¶
func (c *HipchatConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type InhibitRule ¶
type InhibitRule struct { // SourceMatch defines a set of labels that have to equal the given // value for source alerts. SourceMatch map[string]string `yaml:"source_match" json:"source_match"` // SourceMatchRE defines pairs like SourceMatch but does regular expression // matching. SourceMatchRE map[string]Regexp `yaml:"source_match_re" json:"source_match_re"` // TargetMatch defines a set of labels that have to equal the given // value for target alerts. TargetMatch map[string]string `yaml:"target_match" json:"target_match"` // TargetMatchRE defines pairs like TargetMatch but does regular expression // matching. TargetMatchRE map[string]Regexp `yaml:"target_match_re" json:"target_match_re"` // A set of labels that must be equal between the source and target alert // for them to be a match. Equal model.LabelNames `yaml:"equal" json:"equal"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
InhibitRule defines an inhibition rule that mutes alerts that match the target labels if an alert matching the source labels exists. Both alerts have to have a set of labels being equal.
func (*InhibitRule) UnmarshalYAML ¶
func (r *InhibitRule) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type NotifierConfig ¶
type NotifierConfig struct {
VSendResolved bool `yaml:"send_resolved" json:"send_resolved"`
}
NotifierConfig contains base options common across all notifier configurations.
func (*NotifierConfig) SendResolved ¶
func (nc *NotifierConfig) SendResolved() bool
type OpsGenieConfig ¶
type OpsGenieConfig struct { NotifierConfig `yaml:",inline" json:",inline"` APIKey Secret `yaml:"api_key" json:"api_key"` APIHost string `yaml:"api_host" json:"api_host"` Message string `yaml:"message" json:"message"` Description string `yaml:"description" json:"description"` Source string `yaml:"source" json:"source"` Details map[string]string `yaml:"details" json:"details"` Teams string `yaml:"teams" json:"teams"` Tags string `yaml:"tags" json:"tags"` Note string `yaml:"note" json:"note"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
OpsGenieConfig configures notifications via OpsGenie.
func (*OpsGenieConfig) UnmarshalYAML ¶
func (c *OpsGenieConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type PagerdutyConfig ¶
type PagerdutyConfig struct { NotifierConfig `yaml:",inline" json:",inline"` ServiceKey Secret `yaml:"service_key" json:"service_key"` URL string `yaml:"url" json:"url"` Client string `yaml:"client" json:"client"` ClientURL string `yaml:"client_url" json:"client_url"` Description string `yaml:"description" json:"description"` Details map[string]string `yaml:"details" json:"details"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
PagerdutyConfig configures notifications via PagerDuty.
func (*PagerdutyConfig) UnmarshalYAML ¶
func (c *PagerdutyConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type PushoverConfig ¶
type PushoverConfig struct { NotifierConfig `yaml:",inline" json:",inline"` UserKey Secret `yaml:"user_key" json:"user_key"` Token Secret `yaml:"token" json:"token"` Title string `yaml:"title" json:"title"` Message string `yaml:"message" json:"message"` URL string `yaml:"url" json:"url"` Priority string `yaml:"priority" json:"priority"` Retry duration `yaml:"retry" json:"retry"` Expire duration `yaml:"expire" json:"expire"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
func (*PushoverConfig) UnmarshalYAML ¶
func (c *PushoverConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Receiver ¶
type Receiver struct { // A unique identifier for this receiver. Name string `yaml:"name" json:"name"` EmailConfigs []*EmailConfig `yaml:"email_configs,omitempty" json:"email_configs,omitempty"` PagerdutyConfigs []*PagerdutyConfig `yaml:"pagerduty_configs,omitempty" json:"pagerduty_configs,omitempty"` HipchatConfigs []*HipchatConfig `yaml:"hipchat_configs,omitempty" json:"hipchat_configs,omitempty"` SlackConfigs []*SlackConfig `yaml:"slack_configs,omitempty" json:"slack_configs,omitempty"` WebhookConfigs []*WebhookConfig `yaml:"webhook_configs,omitempty" json:"webhook_configs,omitempty"` OpsGenieConfigs []*OpsGenieConfig `yaml:"opsgenie_configs,omitempty" json:"opsgenie_configs,omitempty"` PushoverConfigs []*PushoverConfig `yaml:"pushover_configs,omitempty" json:"pushover_configs,omitempty"` VictorOpsConfigs []*VictorOpsConfig `yaml:"victorops_configs,omitempty" json:"victorops_configs,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
Receiver configuration provides configuration on how to contact a receiver.
func (*Receiver) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Regexp ¶
Regexp encapsulates a regexp.Regexp and makes it YAML marshalable.
func (*Regexp) MarshalJSON ¶ added in v0.6.0
MarshalJSON implements the json.Marshaler interface.
func (*Regexp) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalJSON ¶ added in v0.6.0
UnmarshalJSON implements the json.Marshaler interface
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Route ¶
type Route struct { Receiver string `yaml:"receiver,omitempty" json:"receiver,omitempty"` GroupBy []model.LabelName `yaml:"group_by,omitempty" json:"group_by,omitempty"` Match map[string]string `yaml:"match,omitempty" json:"match,omitempty"` MatchRE map[string]Regexp `yaml:"match_re,omitempty" json:"match_re,omitempty"` Continue bool `yaml:"continue,omitempty" json:"continue,omitempty"` Routes []*Route `yaml:"routes,omitempty" json:"routes,omitempty"` GroupWait *model.Duration `yaml:"group_wait,omitempty" json:"group_wait,omitempty"` GroupInterval *model.Duration `yaml:"group_interval,omitempty" json:"group_interval,omitempty"` RepeatInterval *model.Duration `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
A Route is a node that contains definitions of how to handle alerts.
func (*Route) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Secret ¶
type Secret string
Secret is a string that must not be revealed on marshaling.
func (Secret) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
type SlackConfig ¶
type SlackConfig struct { NotifierConfig `yaml:",inline" json:",inline"` APIURL Secret `yaml:"api_url" json:"api_url"` // Slack channel override, (like #other-channel or @username). Channel string `yaml:"channel" json:"channel"` Username string `yaml:"username" json:"username"` Color string `yaml:"color" json:"color"` Title string `yaml:"title" json:"title"` TitleLink string `yaml:"title_link" json:"title_link"` Pretext string `yaml:"pretext" json:"pretext"` Text string `yaml:"text" json:"text"` Fallback string `yaml:"fallback" json:"fallback"` IconEmoji string `yaml:"icon_emoji" json:"icon_emoji"` IconURL string `yaml:"icon_url" json:"icon_url"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
SlackConfig configures notifications via Slack.
func (*SlackConfig) UnmarshalYAML ¶
func (c *SlackConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type VictorOpsConfig ¶ added in v0.5.0
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:"state_message" json:"state_message"` MonitoringTool string `yaml:"monitoring_tool" json:"monitoring_tool"` XXX map[string]interface{} `yaml:",inline" json:"-"` }
VictorOpsConfig configures notifications via VictorOps.
func (*VictorOpsConfig) UnmarshalYAML ¶ added in v0.5.0
func (c *VictorOpsConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.
type WebhookConfig ¶
type WebhookConfig struct { NotifierConfig `yaml:",inline" json:",inline"` // URL to send POST request to. URL string `yaml:"url" json:"url"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline" json:"-"` }
WebhookConfig configures notifications via a generic webhook.
func (*WebhookConfig) UnmarshalYAML ¶
func (c *WebhookConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface.