Documentation ¶
Index ¶
- type Config
- type Diagnostic
- type HandlerConfig
- type Service
- func (s *Service) Alert(...) error
- func (s *Service) Close() error
- func (s *Service) DefaultHandlerConfig() HandlerConfig
- func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) (alert.Handler, error)
- func (s *Service) Open() error
- func (s *Service) Test(options interface{}) error
- func (s *Service) TestOptions() interface{}
- func (s *Service) Update(newConfig []interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Whether Alerta integration is enabled. Enabled bool `toml:"enabled" override:"enabled"` // The Alerta URL. URL string `toml:"url" override:"url"` // Whether to skip the tls verification of the alerta host InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"` // The authentication token for this notification, can be overridden per alert. Token string `toml:"token" override:"token,redact"` // The prefix for the Authentication field where the token is stored // This defaults to Bearer but you may need to set this to "Key" for older versions of alerta TokenPrefix string `toml:"token-prefix" override:"token-prefix"` // The environment in which to raise the alert. Environment string `toml:"environment" override:"environment"` // The origin of the alert. Origin string `toml:"origin" override:"origin"` // Optional timeout, can be overridden per alert. Timeout toml.Duration `toml:"timeout" override:"timeout"` }
type Diagnostic ¶ added in v1.4.0
type HandlerConfig ¶ added in v1.2.0
type HandlerConfig struct { // Alerta authentication token. // If empty uses the token from the configuration. Token string `mapstructure:"token"` // Alerta authentication token prefix. // If empty uses Bearer. TokenPrefix string `mapstructure:"token-prefix"` // Alerta resource. // Can be a template and has access to the same data as the AlertNode.Details property. // Default: {{ .Name }} Resource string `mapstructure:"resource"` // Alerta event. // Can be a template and has access to the same data as the idInfo property. // Default: {{ .ID }} Event string `mapstructure:"event"` // Alerta environment. // Can be a template and has access to the same data as the AlertNode.Details property. // Defaut is set from the configuration. Environment string `mapstructure:"environment"` // Alerta group. // Can be a template and has access to the same data as the AlertNode.Details property. // Default: {{ .Group }} Group string `mapstructure:"group"` // Alerta value. // Can be a template and has access to the same data as the AlertNode.Details property. // Default is an empty string. Value string `mapstructure:"value"` // Alerta origin. // If empty uses the origin from the configuration. Origin string `mapstructure:"origin"` // List of effected Services Service []string `mapstructure:"service"` // List of correlated events Correlate []string `mapstructure:"correlate"` // Map of alert attributes Attributes map[string]interface{} `mapstructure:"attributes"` // Alerta timeout. // Default: 24h Timeout time.Duration `mapstructure:"timeout"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(c Config, d Diagnostic) *Service
func (*Service) DefaultHandlerConfig ¶ added in v1.2.0
func (s *Service) DefaultHandlerConfig() HandlerConfig
func (*Service) TestOptions ¶ added in v1.1.0
func (s *Service) TestOptions() interface{}
Click to show internal directories.
Click to hide internal directories.