notify

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2016 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const MinTimeout = 10 * time.Second

MinTimeout is the minimum timeout that is set for the context of a call to a notification pipeline.

Variables

This section is empty.

Functions

func Build

func Build(confs []*config.Receiver, tmpl *template.Template) map[string]Fanout

Build creates a fanout notifier for each receiver.

func GroupKey

func GroupKey(ctx context.Context) (model.Fingerprint, bool)

GroupKey extracts a group key from the context. Iff none exists, the second argument is false.

func GroupLabels

func GroupLabels(ctx context.Context) (model.LabelSet, bool)

GroupLabels extracts grouping label set from the context. Iff none exists, the second argument is false.

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

func Now

func Now(ctx context.Context) (time.Time, bool)

Now extracts a now timestamp from the context. Iff none exists, the second argument is false.

func Receiver

func Receiver(ctx context.Context) (string, bool)

Receiver extracts a receiver from the context. Iff none exists, the second argument is false.

func RepeatInterval

func RepeatInterval(ctx context.Context) (time.Duration, bool)

RepeatInterval extracts a repeat interval from the context. Iff none exists, the second argument is false.

func WithGroupKey

func WithGroupKey(ctx context.Context, fp model.Fingerprint) context.Context

WithGroupKey populates a context with a group key.

func WithGroupLabels

func WithGroupLabels(ctx context.Context, lset model.LabelSet) context.Context

WithGroupLabels populates a context with grouping labels.

func WithNow

func WithNow(ctx context.Context, t time.Time) context.Context

WithNow populates a context with a now timestamp.

func WithReceiver

func WithReceiver(ctx context.Context, rcv string) context.Context

WithReceiver populates a context with a receiver.

func WithRepeatInterval

func WithRepeatInterval(ctx context.Context, t time.Duration) context.Context

WithRepeatInterval populates a context with a repeat interval.

Types

type DedupingNotifier

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

DedupingNotifier filters and forwards alerts to another notifier. Filtering happens based on a provider of NotifyInfos. On successful notification new NotifyInfos are set.

func Dedup

func Dedup(notifies provider.Notifies, n Notifier) *DedupingNotifier

Dedup wraps a Notifier in a DedupingNotifier that runs against the given NotifyInfo provider.

func (*DedupingNotifier) Notify

func (n *DedupingNotifier) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type Email

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

Email implements a Notifier for email notifications.

func NewEmail

func NewEmail(c *config.EmailConfig, t *template.Template) *Email

NewEmail returns a new Email notifier.

func (*Email) Notify

func (n *Email) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

type Fanout

type Fanout map[string]Notifier

Fanout sends notifications through all notifiers it holds at once.

func (Fanout) Notify

func (ns Fanout) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify attempts to notify all Notifiers concurrently. It returns a types.MultiError if any of them fails.

type Hipchat

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

Hipchat implements a Notifier for Hipchat notifications.

func NewHipchat

func NewHipchat(conf *config.HipchatConfig, tmpl *template.Template) *Hipchat

NewHipchat returns a new Hipchat notification handler.

func (*Hipchat) Notify

func (n *Hipchat) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

type InhibitNotifier

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

InhibitNotifier filters alerts through an inhibition muter before passing it on to the next Notifier

func Inhibit

func Inhibit(m types.Muter, n Notifier, mk types.Marker) *InhibitNotifier

Inhibit return a new InhibitNotifier.

func (*InhibitNotifier) Notify

func (n *InhibitNotifier) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type LogNotifier

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

LogNotifier logs the alerts to be notified about. It forwards to another Notifier afterwards, if any is provided.

func Log

func Log(n Notifier, log log.Logger) *LogNotifier

Log wraps a Notifier in a LogNotifier with the given Logger.

func (*LogNotifier) Notify

func (n *LogNotifier) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type Notifier

type Notifier interface {
	Notify(context.Context, ...*types.Alert) error
}

A Notifier is a type which notifies about alerts under constraints of the given context.

type NotifierFunc

type NotifierFunc func(context.Context, ...*types.Alert) error

func (NotifierFunc) Notify

func (f NotifierFunc) Notify(ctx context.Context, alerts ...*types.Alert) error

type OpsGenie

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

OpsGenie implements a Notifier for OpsGenie notifications.

func NewOpsGenie

func NewOpsGenie(c *config.OpsGenieConfig, t *template.Template) *OpsGenie

NewOpsGenie returns a new OpsGenie notifier.

func (*OpsGenie) Notify

func (n *OpsGenie) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

type PagerDuty

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

PagerDuty implements a Notifier for PagerDuty notifications.

func NewPagerDuty

func NewPagerDuty(c *config.PagerdutyConfig, t *template.Template) *PagerDuty

NewPagerDuty returns a new PagerDuty notifier.

func (*PagerDuty) Notify

func (n *PagerDuty) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

http://developer.pagerduty.com/documentation/integration/events/trigger

type Pushover

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

Pushover implements a Notifier for Pushover notifications.

func NewPushover

func NewPushover(c *config.PushoverConfig, t *template.Template) *Pushover

NewPushover returns a new Pushover notifier.

func (*Pushover) Notify

func (n *Pushover) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

type RetryNotifier

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

RetryNotifier accepts another notifier and retries notifying on error with exponential backoff.

func Retry

func Retry(n Notifier) *RetryNotifier

Retry wraps the given notifier in a RetryNotifier.

func (*RetryNotifier) Notify

func (n *RetryNotifier) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify calls the underlying notifier with exponential backoff until it succeeds. It aborts if the context is canceled or timed out.

type Router

type Router map[string]Notifier

Router dispatches the alerts to one of a set of named notifiers based on the name value provided in the context.

func (Router) Notify

func (rs Router) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type SilenceNotifier

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

SilenceNotifier filters alerts through a silence muter before passing it on to the next Notifier

func Silence

func Silence(m types.Muter, n Notifier, mk types.Marker) *SilenceNotifier

Silence returns a new SilenceNotifier.

func (*SilenceNotifier) Notify

func (n *SilenceNotifier) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type Slack

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

Slack implements a Notifier for Slack notifications.

func NewSlack

func NewSlack(conf *config.SlackConfig, tmpl *template.Template) *Slack

NewSlack returns a new Slack notification handler.

func (*Slack) Notify

func (n *Slack) Notify(ctx context.Context, as ...*types.Alert) error

Notify implements the Notifier interface.

type Webhook

type Webhook struct {
	// The URL to which notifications are sent.
	URL string
	// contains filtered or unexported fields
}

Webhook implements a Notifier for generic webhooks.

func NewWebhook

func NewWebhook(conf *config.WebhookConfig, t *template.Template) *Webhook

NewWebhook returns a new Webhook.

func (*Webhook) Notify

func (w *Webhook) Notify(ctx context.Context, alerts ...*types.Alert) error

Notify implements the Notifier interface.

type WebhookMessage

type WebhookMessage struct {
	*template.Data

	// The protocol version.
	Version  string `json:"version"`
	GroupKey uint64 `json:"groupKey"`
}

WebhookMessage defines the JSON object send to webhook endpoints.

Jump to

Keyboard shortcuts

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