alerting

package
v0.0.0-...-f194415 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alerter

type Alerter interface {
	Alert(ContainerRestartEvent) error
}

Alerter represents something that can trigger an alert to an external service. For example, to slack, or opsgenie.

func NewLogAlerter

func NewLogAlerter() Alerter

NewLogAlerter is just a constructor, dead useful docstring this. Love linters.

func NewSlackAlerter

func NewSlackAlerter(webhookURL, channel, templatePath string) Alerter

NewSlackAlerter creates a slack alerter with the correct webhooks, channel and returns it as the Alerter interface.

type ContainerRestartEvent

type ContainerRestartEvent struct {
	ContainerName string
	ClusterName   string
	PodName       string
	Namespace     string
	Reason        string
	LastLogs      string
}

type LogAlerter

type LogAlerter bool

LogAlerter is a dead simple alerter which simply logs to console.

func (LogAlerter) Alert

func (la LogAlerter) Alert(cre ContainerRestartEvent) error

Alert implements the Alerter interface for LogAlerter.

type Registry

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

Registry holds all the available alerters to be used by deadman switches.

func NewRegistry

func NewRegistry() Registry

NewRegistry simply allocates a new registry with all fields properly created.

func NewRegistryFromConfig

func NewRegistryFromConfig(viper *viper.Viper) Registry

NewRegistryFromConfig will create a Registry from a viper/json config file.

func (*Registry) AddAlerter

func (r *Registry) AddAlerter(name string, a Alerter)

AddAlerter adds an alerter to the registry.

func (*Registry) GetAlerter

func (r *Registry) GetAlerter(name string) Alerter

GetAlerter finds the alerter associated with a name.

type SlackAlerter

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

SlackAlerter is an alerter which sends its alert messages to a slack channel, over a webhook.

func (SlackAlerter) Alert

Alert implements the Alerter interface.

Jump to

Keyboard shortcuts

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