bigpanda

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 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 Config

type Config struct {
	// Whether BigPanda integration is enabled.
	Enabled bool `toml:"enabled" override:"enabled"`

	// Whether all alerts should automatically post to BigPanda.
	Global bool `toml:"global" override:"global"`

	// Each integration must have an App Key in BigPanda to identify it as a unique source.
	AppKey string `toml:"app-key" override:"app-key"`

	// Each integration must have an App Key in BigPanda to identify it as a unique source.
	Token string `toml:"token" override:"token,redact"`

	// Whether all alerts should automatically use stateChangesOnly mode.
	// Only applies if global is also set.
	StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`

	// Whether to skip the tls verification
	InsecureSkipVerify bool `toml:"insecure-skip-verify" override:"insecure-skip-verify"`

	// BigPanda Alert API URL, if not specified https://api.bigpanda.io/data/v2/alerts is used.
	URL string `toml:"url" override:"url"`

	// Option to control tags and fields serialization into payload (for backward compatibility).
	AutoAttributes string `toml:"auto-attributes" override:"auto-attributes"`
}

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 {
	// BigPanda AppKey
	AppKey string `mapstructure:"app-key"`

	// webhook URL used to post alert.
	// If empty uses the service URL from the configuration.
	URL string `mapstructure:"url"`

	// object that caused the alert
	Host string `mapstructure:"host"`

	// custom primary BigPanda property
	PrimaryProperty string `mapstructure:"primary-property"`

	// custom secondary BigPanda property
	SecondaryProperty string `mapstructure:"secondary-property"`

	// additional attributes
	Attributes map[string]interface{} `mapstructure:"attributes"`
}

HandlerConfig defines the high-level struct required to connect to BigPanda

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(c Config, d Diagnostic) (*Service, error)

func (*Service) Alert

func (s *Service) Alert(id string, message string, details string, level alert.Level, timestamp time.Time, data alert.EventData, hc *HandlerConfig, attrs map[string]string) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) Global

func (s *Service) Global() bool

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) StateChangesOnly

func (s *Service) StateChangesOnly() bool

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