snmptrap

package
v1.5.8-rc0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 11 Imported by: 64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Whether Snmptrap is enabled.
	Enabled bool `toml:"enabled" override:"enabled"`
	// The host:port address of the SNMP trap server
	Addr string `toml:"addr" override:"addr"`
	// SNMP Community
	Community string `toml:"community" override:"community,redact"`
	// Retries count for traps
	Retries int `toml:"retries" override:"retries"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type Data

type Data struct {
	Oid   string `mapstructure:"oid" json:"oid"`
	Type  string `mapstructure:"type" json:"type"`
	Value string `mapstructure:"value" json:"value"`
	// contains filtered or unexported fields
}

type Diagnostic added in v1.4.0

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	Error(msg string, err error)
}

type HandlerConfig

type HandlerConfig struct {
	TrapOid  string `mapstructure:"trap-oid"`
	DataList []Data `mapstructure:"data-list"`
}

type Service

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

func NewService

func NewService(c Config, d Diagnostic) *Service

func (*Service) Close

func (s *Service) Close() error

func (*Service) Handler

func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) (alert.Handler, error)

Handler creates a handler from the config.

func (*Service) Open

func (s *Service) Open() error

func (*Service) Test

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions

func (s *Service) TestOptions() interface{}

func (*Service) Trap

func (s *Service) Trap(trapOid string, dataList []Data) error

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