notifier

package
v0.0.0-...-a7b6888 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: BSD-3-Clause Imports: 11 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 {
	Interval time.Duration           `yaml:"interval"`
	Backends []NotifierBackendConfig `yaml:"backends"`
	Targets  []NotifierTarget        `yaml:"targets"`
}

type EMailBackend

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

func NewEMailBackend

func NewEMailBackend(name string, conf *NotifierBackendConfigEMail, infoLog, dbgLog *log.Logger) *EMailBackend

func (*EMailBackend) Close

func (emb *EMailBackend) Close() error

func (*EMailBackend) Init

func (emb *EMailBackend) Init() (err error)

func (*EMailBackend) Notify

func (emb *EMailBackend) Notify(ctx context.Context, target NotifierTarget, alert *store.Alert) (bool, error)

func (*EMailBackend) Ready

func (emb *EMailBackend) Ready() bool

type Notifier

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

func NewNotifier

func NewNotifier(conf *Config, st *store.Store, infoLog, dbgLog *log.Logger) (n *Notifier, err error)

func (*Notifier) Close

func (n *Notifier) Close() error

type NotifierBackend

type NotifierBackend interface {
	Init() error
	Ready() bool
	Notify(context.Context, NotifierTarget, *store.Alert) (bool, error)
	Close() error
}

type NotifierBackendConfig

type NotifierBackendConfig struct {
	Name     string
	EMail    *NotifierBackendConfigEMail    `yaml:"email"`
	SMSModem *NotifierBackendConfigSMSModem `yaml:"smsModem"`
}

type NotifierBackendConfigEMail

type NotifierBackendConfigEMail struct {
	From      string `yaml:"from"`
	Smarthost string `yaml:"smarthost"`
}

type NotifierBackendConfigSMSModem

type NotifierBackendConfigSMSModem struct {
	Device   string        `yaml:"device"`
	Baudrate int           `yaml:"baudrate"`
	Timeout  time.Duration `yaml:"timeout"`
	Pin      *uint         `yaml:"pin"`
	Template string        `yaml:"template"`
}

type NotifierTarget

type NotifierTarget struct {
	Name  string               `yaml:"name"`
	EMail *NotifierTargetEMail `yaml:"email"`
	SMS   *NotifierTargetSMS   `yaml:"sms"`
}

type NotifierTargetEMail

type NotifierTargetEMail string

type NotifierTargetSMS

type NotifierTargetSMS string

type SMSModemBackend

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

func NewSMSModemBackend

func NewSMSModemBackend(name string, conf *NotifierBackendConfigSMSModem, infoLog, dbgLog *log.Logger) *SMSModemBackend

func (*SMSModemBackend) Close

func (smb *SMSModemBackend) Close() error

func (*SMSModemBackend) Init

func (smb *SMSModemBackend) Init() (err error)

func (*SMSModemBackend) Notify

func (smb *SMSModemBackend) Notify(ctx context.Context, target NotifierTarget, alert *store.Alert) (bool, error)

func (*SMSModemBackend) Ready

func (smb *SMSModemBackend) Ready() bool

Jump to

Keyboard shortcuts

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