alertmanager

package
v0.0.0-...-298395c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerAnnotations

type AlertmanagerAnnotations struct {
	Summary  string `json:"summary"`
	Value    string `json:"value"`
	Severity string `json:"severity"`
}

type AlertmanagerLabels

type AlertmanagerLabels struct {
	Instance    string   `json:"instance"`
	Event       string   `json:"event"`
	Environment string   `json:"environment"`
	Origin      string   `json:"origin"`
	Service     []string `json:"service"`
	Group       string   `json:"group"`
	Customer    string   `json:"customer"`
}

type AlertmanagerRequest

type AlertmanagerRequest struct {
	Status      string                  `json:"status"`
	Labels      AlertmanagerLabels      `json:"labels"`
	Annotations AlertmanagerAnnotations `json:"annotations"`
}

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 alertmanager host
	InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"`
	// 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"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type Diagnostic

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	TemplateError(err error, kv keyvalue.T)
	Error(msg string, err error)
}

type HandlerConfig

type HandlerConfig struct {
	// Alertmanager resource.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default: {{ .Name }}
	Resource string `mapstructure:"resource"`

	// Alertmanager event.
	// Can be a template and has access to the same data as the idInfo property.
	// Default: {{ .ID }}
	Event string `mapstructure:"event"`

	// Alertmanager 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"`

	// Alertmanager group.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default: {{ .Group }}
	Group string `mapstructure:"group"`

	// Alertmanager group.
	// Can be a template and has access to the same data as the AlertNode.Details property.
	// Default: {{ .Group }}
	Customer string `mapstructure:"customer"`

	// Alertmanager 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"`

	// Alertmanager origin.
	// If empty uses the origin from the configuration.
	Origin string `mapstructure:"origin"`

	// List of effected Services
	Service []string `mapstructure:"service"`

	// Alertmanager 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) Alert

func (s *Service) Alert(status, resource, event, environment, severity, group, customer, value, message, origin string, service []string, timeout time.Duration, tags map[string]string, data models.Result) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) DefaultHandlerConfig

func (s *Service) DefaultHandlerConfig() HandlerConfig

func (*Service) Handler

func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) (alert.Handler, error)

func (*Service) Open

func (s *Service) Open() error

func (*Service) Test

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions

func (s *Service) TestOptions() interface{}

func (*Service) Update

func (s *Service) Update(newConfig []interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL