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.message" . }}`, From: `{{ template "victorops.default.from" . }}`, } // 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"` Route *Route `yaml:"route,omitempty"` InhibitRules []*InhibitRule `yaml:"inhibit_rules,omitempty"` Receivers []*Receiver `yaml:"receivers,omitempty"` Templates []string `yaml:"templates"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` // 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"` // Email address to notify. To string `yaml:"to"` From string `yaml:"from"` Smarthost string `yaml:"smarthost,omitempty"` AuthUsername string `yaml:"auth_username"` AuthPassword Secret `yaml:"auth_password"` AuthSecret Secret `yaml:"auth_secret"` AuthIdentity string `yaml:"auth_identity"` Headers map[string]string `yaml:"headers"` HTML string `yaml:"html"` RequireTLS *bool `yaml:"require_tls,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` SMTPFrom string `yaml:"smtp_from"` SMTPSmarthost string `yaml:"smtp_smarthost"` SMTPAuthUsername string `yaml:"smtp_auth_username"` SMTPAuthPassword Secret `yaml:"smtp_auth_password"` SMTPAuthSecret Secret `yaml:"smtp_auth_secret"` SMTPAuthIdentity string `yaml:"smtp_auth_identity"` SMTPRequireTLS bool `yaml:"smtp_require_tls"` SlackAPIURL Secret `yaml:"slack_api_url"` PagerdutyURL string `yaml:"pagerduty_url"` HipchatURL string `yaml:"hipchat_url"` HipchatAuthToken Secret `yaml:"hipchat_auth_token"` OpsGenieAPIHost string `yaml:"opsgenie_api_host"` VictorOpsAPIURL string `yaml:"victorops_api_url"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` APIURL string `yaml:"api_url"` AuthToken Secret `yaml:"auth_token"` RoomID string `yaml:"room_id"` From string `yaml:"from"` Notify bool `yaml:"notify"` Message string `yaml:"message"` MessageFormat string `yaml:"message_format"` Color string `yaml:"color"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` // SourceMatchRE defines pairs like SourceMatch but does regular expression // matching. SourceMatchRE map[string]Regexp `yaml:"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"` // TargetMatchRE defines pairs like TargetMatch but does regular expression // matching. TargetMatchRE map[string]Regexp `yaml:"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"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"`
}
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"` APIKey Secret `yaml:"api_key"` APIHost string `yaml:"api_host"` Message string `yaml:"message"` Description string `yaml:"description"` Source string `yaml:"source"` Details map[string]string `yaml:"details"` Teams string `yaml:"teams"` Tags string `yaml:"tags"` Note string `yaml:"note"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` ServiceKey Secret `yaml:"service_key"` URL string `yaml:"url"` Client string `yaml:"client"` ClientURL string `yaml:"client_url"` Description string `yaml:"description"` Details map[string]string `yaml:"details"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` UserKey Secret `yaml:"user_key"` Token Secret `yaml:"token"` Title string `yaml:"title"` Message string `yaml:"message"` URL string `yaml:"url"` Priority string `yaml:"priority"` Retry duration `yaml:"retry"` Expire duration `yaml:"expire"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` EmailConfigs []*EmailConfig `yaml:"email_configs,omitempty"` PagerdutyConfigs []*PagerdutyConfig `yaml:"pagerduty_configs,omitempty"` HipchatConfigs []*HipchatConfig `yaml:"hipchat_configs,omitempty"` SlackConfigs []*SlackConfig `yaml:"slack_configs,omitempty"` WebhookConfigs []*WebhookConfig `yaml:"webhook_configs,omitempty"` OpsGenieConfigs []*OpsGenieConfig `yaml:"opsgenie_configs,omitempty"` PushoverConfigs []*PushoverConfig `yaml:"pushover_configs,omitempty"` VictorOpsConfigs []*VictorOpsConfig `yaml:"victorops_configs,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface.
func (*Regexp) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type Route ¶
type Route struct { Receiver string `yaml:"receiver,omitempty"` GroupBy []model.LabelName `yaml:"group_by,omitempty"` Match map[string]string `yaml:"match,omitempty"` MatchRE map[string]Regexp `yaml:"match_re,omitempty"` Continue bool `yaml:"continue,omitempty"` Routes []*Route `yaml:"routes,omitempty"` GroupWait *model.Duration `yaml:"group_wait,omitempty"` GroupInterval *model.Duration `yaml:"group_interval,omitempty"` RepeatInterval *model.Duration `yaml:"repeat_interval,omitempty"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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"` APIURL Secret `yaml:"api_url"` // Slack channel override, (like #other-channel or @username). Channel string `yaml:"channel"` Username string `yaml:"username"` Color string `yaml:"color"` Title string `yaml:"title"` TitleLink string `yaml:"title_link"` Pretext string `yaml:"pretext"` 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"` }
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"` APIKey Secret `yaml:"api_key"` APIURL string `yaml:"api_url"` RoutingKey string `yaml:"routing_key"` MessageType string `yaml:"message_type"` StateMessage string `yaml:"message"` From string `yaml:"from"` XXX map[string]interface{} `yaml:",inline"` }
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"` // URL to send POST request to. URL string `yaml:"url"` // Catches all undefined fields and must be empty after parsing. XXX map[string]interface{} `yaml:",inline"` }
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.