Documentation
¶
Index ¶
- Constants
- func MakeBaseRouteName(tenantID string) string
- func ReceiverTenantPrefix(tenantID string) string
- func SecureReceiverName(name, tenantID string) string
- func UnsecureReceiverName(name, tenantID string) string
- type Config
- func (c *Config) GetReceiver(name string) *Receiver
- func (c *Config) GetRouteIdx(name string) int
- func (c *Config) InitializeNetworkBaseRoute(route *Route, matcherLabel, tenantID string) error
- func (c *Config) RemoveReceiverFromRoute(receiver string)
- func (c *Config) SearchRoutesForReceiver(receiver string) bool
- func (c *Config) Validate() error
- type EmailConfig
- type GlobalConfig
- type PagerDutyConfig
- type PushoverConfig
- type PushoverJSONWrapper
- type Receiver
- type ReceiverJSONWrapper
- type Route
- type SlackConfig
- type WebhookConfig
Constants ¶
const (
TenantBaseRoutePostfix = "tenant_base_route"
)
Variables ¶
This section is empty.
Functions ¶
func MakeBaseRouteName ¶
func ReceiverTenantPrefix ¶
func SecureReceiverName ¶
func UnsecureReceiverName ¶
Types ¶
type Config ¶
type Config struct { Global *GlobalConfig `yaml:"global,omitempty" json:"global,omitempty"` Route *Route `yaml:"route,omitempty" json:"route,omitempty"` InhibitRules []*amconfig.InhibitRule `yaml:"inhibit_rules,omitempty" json:"inhibit_rules,omitempty"` Receivers []*Receiver `yaml:"receivers,omitempty" json:"receivers,omitempty"` Templates []string `yaml:"templates" json:"templates"` }
Config uses a custom receiver struct to avoid scrubbing of 'secrets' during marshaling
func (*Config) GetReceiver ¶
GetReceiver returns the receiver config with the given name
func (*Config) GetRouteIdx ¶
func (*Config) InitializeNetworkBaseRoute ¶
func (*Config) RemoveReceiverFromRoute ¶ added in v1.0.4
func (*Config) SearchRoutesForReceiver ¶ added in v1.0.4
type EmailConfig ¶
type EmailConfig struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` To string `yaml:"to,omitempty" json:"to,omitempty"` From string `yaml:"from,omitempty" json:"from,omitempty"` Hello string `yaml:"hello,omitempty" json:"hello,omitempty"` Smarthost string `yaml:"smarthost,omitempty" json:"smarthost,omitempty"` AuthUsername string `yaml:"auth_username,omitempty" json:"auth_username,omitempty"` AuthPassword string `yaml:"auth_password,omitempty" json:"auth_password,omitempty"` AuthSecret string `yaml:"auth_secret,omitempty" json:"auth_secret,omitempty"` AuthIdentity string `yaml:"auth_identity,omitempty" json:"auth_identity,omitempty"` Headers map[string]string `yaml:"headers,omitempty" json:"headers,omitempty"` HTML string `yaml:"html,omitempty" json:"html,omitempty"` Text string `yaml:"text,omitempty" json:"text,omitempty"` RequireTLS *bool `yaml:"require_tls,omitempty" json:"require_tls,omitempty"` }
EmailConfig uses string instead of Secret for the AuthPassword and AuthSecret field so that it is marshaled as is instead of being obscured which is how alertmanager handles secrets. Otherwise the secrets would be obscured on write to the yml file, making it unusable.
type GlobalConfig ¶
type GlobalConfig struct { // ResolveTimeout is the time after which an alert is declared resolved // if it has not been updated. ResolveTimeout string `yaml:"resolve_timeout" json:"resolve_timeout"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` SMTPFrom string `yaml:"smtp_from,omitempty" json:"smtp_from,omitempty"` SMTPHello string `yaml:"smtp_hello,omitempty" json:"smtp_hello,omitempty"` SMTPSmarthost string `yaml:"smtp_smarthost,omitempty" json:"smtp_smarthost,omitempty"` SMTPAuthUsername string `yaml:"smtp_auth_username,omitempty" json:"smtp_auth_username,omitempty"` SMTPAuthPassword string `yaml:"smtp_auth_password,omitempty" json:"smtp_auth_password,omitempty"` SMTPAuthSecret string `yaml:"smtp_auth_secret,omitempty" json:"smtp_auth_secret,omitempty"` SMTPAuthIdentity string `yaml:"smtp_auth_identity,omitempty" json:"smtp_auth_identity,omitempty"` SMTPRequireTLS bool `yaml:"smtp_require_tls,omitempty" json:"smtp_require_tls,omitempty"` SlackAPIURL *amconfig.URL `yaml:"slack_api_url,omitempty" json:"slack_api_url,omitempty"` PagerdutyURL *amconfig.URL `yaml:"pagerduty_url,omitempty" json:"pagerduty_url,omitempty"` HipchatAPIURL *amconfig.URL `yaml:"hipchat_api_url,omitempty" json:"hipchat_api_url,omitempty"` HipchatAuthToken string `yaml:"hipchat_auth_token,omitempty" json:"hipchat_auth_token,omitempty"` OpsGenieAPIURL *amconfig.URL `yaml:"opsgenie_api_url,omitempty" json:"opsgenie_api_url,omitempty"` OpsGenieAPIKey string `yaml:"opsgenie_api_key,omitempty" json:"opsgenie_api_key,omitempty"` WeChatAPIURL *amconfig.URL `yaml:"wechat_api_url,omitempty" json:"wechat_api_url,omitempty"` WeChatAPISecret string `yaml:"wechat_api_secret,omitempty" json:"wechat_api_secret,omitempty"` WeChatAPICorpID string `yaml:"wechat_api_corp_id,omitempty" json:"wechat_api_corp_id,omitempty"` VictorOpsAPIURL *amconfig.URL `yaml:"victorops_api_url,omitempty" json:"victorops_api_url,omitempty"` VictorOpsAPIKey string `yaml:"victorops_api_key,omitempty" json:"victorops_api_key,omitempty"` }
GlobalConfig is a copy of prometheus/alertmanager/config.GlobalConfig with `Secret` fields replaced with strings to enable marshaling without obfuscation
func DefaultGlobalConfig ¶
func DefaultGlobalConfig() GlobalConfig
type PagerDutyConfig ¶
type PagerDutyConfig struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` RoutingKey string `yaml:"routing_key,omitempty" json:"routing_key,omitempty"` ServiceKey string `yaml:"service_key,omitempty" json:"service_key,omitempty"` URL string `yaml:"url,omitempty" json:"url,omitempty"` Client string `yaml:"client,omitempty" json:"client,omitempty"` ClientURL string `yaml:"client_url,omitempty" json:"client_url,omitempty"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Severity string `yaml:"severity,omitempty" json:"severity,omitempty"` Details map[string]string `yaml:"details,omitempty" json:"details,omitempty"` Images []*config.PagerdutyImage `yaml:"images,omitempty" json:"images,omitempty"` Links []*config.PagerdutyLink `yaml:"links,omitempty" json:"links,omitempty"` }
PagerDutyConfig uses string instead of Secret for the RoutingKey and ServiceKey field so that it is mashaled as is instead of being obscured which is how alertmanager handles secrets. Otherwise the secrets would be obscured on write to the yml file, making it unusable.
type PushoverConfig ¶
type PushoverConfig struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` UserKey string `yaml:"user_key" json:"user_key"` Token string `yaml:"token" json:"token"` Title string `yaml:"title,omitempty" json:"title,omitempty"` Message string `yaml:"message,omitempty" json:"message,omitempty"` URL string `yaml:"url,omitempty" json:"url,omitempty"` Priority string `yaml:"priority,omitempty" json:"priority,omitempty"` Retry model.Duration `yaml:"retry,omitempty" json:"retry,omitempty"` Expire model.Duration `yaml:"expire,omitempty" json:"expire,omitempty"` }
PushoverConfig uses string instead of Secret for the UserKey and Token field so that it is mashaled as is instead of being obscured which is how alertmanager handles secrets. Otherwise the secrets would be obscured on write to the yml file, making it unusable.
type PushoverJSONWrapper ¶
type PushoverJSONWrapper struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` UserKey string `yaml:"user_key" json:"user_key"` Token string `yaml:"token" json:"token"` Title string `yaml:"title,omitempty" json:"title,omitempty"` Message string `yaml:"message,omitempty" json:"message,omitempty"` URL string `yaml:"url,omitempty" json:"url,omitempty"` Priority string `yaml:"priority,omitempty" json:"priority,omitempty"` Retry string `yaml:"retry,omitempty" json:"retry,omitempty"` Expire string `yaml:"expire,omitempty" json:"expire,omitempty"` }
type Receiver ¶
type Receiver struct { Name string `yaml:"name" json:"name"` SlackConfigs []*SlackConfig `yaml:"slack_configs,omitempty" json:"slack_configs,omitempty"` WebhookConfigs []*WebhookConfig `yaml:"webhook_configs,omitempty" json:"webhook_configs,omitempty"` EmailConfigs []*EmailConfig `yaml:"email_configs,omitempty" json:"email_configs,omitempty"` PagerDutyConfigs []*PagerDutyConfig `yaml:"pagerduty_configs,omitempty" json:"pagerduty_configs,omitempty"` PushoverConfigs []*PushoverConfig `yaml:"pushover_configs,omitempty" json:"pushover_configs,omitempty"` }
Receiver uses custom notifier configs to allow for marshaling of secrets.
type ReceiverJSONWrapper ¶
type ReceiverJSONWrapper struct { Name string `yaml:"name" json:"name"` SlackConfigs []*SlackConfig `yaml:"slack_configs,omitempty" json:"slack_configs,omitempty"` WebhookConfigs []*WebhookConfig `yaml:"webhook_configs,omitempty" json:"webhook_configs,omitempty"` EmailConfigs []*EmailConfig `yaml:"email_configs,omitempty" json:"email_configs,omitempty"` PagerDutyConfigs []*PagerDutyConfig `yaml:"pagerduty_configs,omitempty" json:"pagerduty_configs,omitempty"` PushoverConfigs []*PushoverJSONWrapper `yaml:"pushover_configs,omitempty" json:"pushover_configs,omitempty"` }
ReceiverJSONWrapper uses custom (JSON compatible) notifier configs to allow for marshaling of secrets.
func (*ReceiverJSONWrapper) ToReceiverFmt ¶
func (r *ReceiverJSONWrapper) ToReceiverFmt() (Receiver, error)
ToReceiverFmt convers the JSONWrapper object to a true Receiver object. This will only be necessary when dealing with Pushover objects for the time being (due to complexities surrounding JSON unmarshalling)
type Route ¶
type Route struct { Receiver string `yaml:"receiver,omitempty" json:"receiver,omitempty"` GroupByStr []string `yaml:"group_by,omitempty" json:"group_by,omitempty"` GroupBy []model.LabelName `yaml:"-" json:"-"` GroupByAll bool `yaml:"-" json:"-"` Match map[string]string `yaml:"match,omitempty" json:"match,omitempty"` MatchRE map[string]config.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 string `yaml:"group_wait,omitempty" json:"group_wait,omitempty"` GroupInterval string `yaml:"group_interval,omitempty" json:"group_interval,omitempty"` RepeatInterval string `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty"` }
Route provides a struct to marshal/unmarshal into an alertmanager route since that struct does not support json encoding
type SlackConfig ¶
type SlackConfig struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` APIURL string `yaml:"api_url" json:"api_url"` Channel string `yaml:"channel" json:"channel"` Username string `yaml:"username" json:"username"` Color string `yaml:"color,omitempty" json:"color,omitempty"` Title string `yaml:"title,omitempty" json:"title,omitempty"` TitleLink string `yaml:"title_link,omitempty" json:"title_link,omitempty"` Pretext string `yaml:"pretext,omitempty" json:"pretext,omitempty"` Text string `yaml:"text,omitempty" json:"text,omitempty"` Fields []*config.SlackField `yaml:"fields,omitempty" json:"fields,omitempty"` ShortFields bool `yaml:"short_fields,omitempty" json:"short_fields,omitempty"` Fallback string `yaml:"fallback,omitempty" json:"fallback,omitempty"` CallbackID string `yaml:"callback_id,omitempty" json:"callback_id,omitempty"` IconEmoji string `yaml:"icon_emoji,omitempty" json:"icon_emoji,omitempty"` IconURL string `yaml:"icon_url,omitempty" json:"icon_url,omitempty"` ImageURL string `yaml:"image_url,omitempty" json:"image_url,omitempty"` ThumbURL string `yaml:"thumb_url,omitempty" json:"thumb_url,omitempty"` LinkNames bool `yaml:"link_names,omitempty" json:"link_names,omitempty"` Actions []*config.SlackAction `yaml:"actions,omitempty" json:"actions,omitempty"` }
SlackConfig uses string instead of SecretURL for the APIURL field so that it is marshaled as is instead of being obscured which is how alertmanager handles secrets
type WebhookConfig ¶
type WebhookConfig struct { config.NotifierConfig `yaml:",inline" json:"notifier_config,inline"` HTTPConfig *common.HTTPConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"` URL *config.URL `yaml:"url" json:"url"` }
WebhookConfig is a copy of prometheus/alertmanager/config.WebhookConfig with alertmanager-configurer's custom HTTPConfig