notifier

package
v0.0.0-...-30c4d99 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2018 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email struct {
	From    string
	To      []string
	Subject string
	Body    string

	Server   string
	Port     int
	User     string
	Password string
}

Email implements Notifier interface for SMTP.

func (*Email) Notify

func (n *Email) Notify(msg Message) error

Notify notifies user via email. It sends message immediately and does not group more messages together. We have no idea of importance of monitored program and the user might prefer not to wait.

func (*Email) String

func (n *Email) String() string

MarshalJSON marshals the Email notifier into its name "email"

type Message

type Message struct {
	Nanny      string        // Nanny's name
	Program    string        // Program's name
	NextSignal time.Duration // How long have we not heard from program.
	Meta       map[string]string
}

Message is used with Notifier's Notify to customise messages sent via different channels.

func (*Message) Format

func (m *Message) Format() string

Format is deafult Message formatter, used to serialize information for some notifiers. This is intended for future use, mainly the ability to set message format from config or from API.

type Notifier

type Notifier interface {
	Notify(Message) error
	String() string
}

Notifier interface is used by Nanny to notify user on different outputs/services.

func NewSentry

func NewSentry(dsn string) (Notifier, error)

NewSentry creates sentry notifier from supplied DSN.

func NewSlack

func NewSlack(webhookURL string) (Notifier, error)

NewSlack creates a new slack notifier sending to the supplied webhookURL.

func NewTwilio

func NewTwilio(accountSid, authToken, appSid, from, to string) Notifier

NewTwilio creates twilio sms sending notifier.

type StdErr

type StdErr struct{}

StdErr implements Notifier interface for stderr output.

func (*StdErr) Notify

func (n *StdErr) Notify(msg Message) error

Notify to stderr.

func (*StdErr) String

func (n *StdErr) String() string

MarshalJSON marshals the stderr notifier into a "stderr" string

Jump to

Keyboard shortcuts

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