trap

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// dimension list
	EventCommunityKey    = "community"
	EventVersionKey      = "version"
	EventEnterpriseKey   = "enterprise"
	EventGenericTrapKey  = "generic_trap"
	EventSpecificTrapKey = "specific_trap"
	EventSnmpTrapOIDKey  = "snmptrapoid"
	EventDisplayNameKey  = "display_name"
	EventAgentAddressKey = "agent_address"
	EventAggentPortKey   = "agent_port"
	EventServerIPKey     = "server_ip"
	EventServerPortKey   = "server_port"
	EventTimestampKey    = "timestamp"
)

Variables

View Source
var (
	ErrWrongVersion = errors.New("wrong snmp version")
)

ErrWrongVersion :

Functions

func Gb18030ToUtf8

func Gb18030ToUtf8(s []byte) ([]byte, error)

Gb18030ToUtf8 gb18030->utf8

func Gb2312ToUtf8

func Gb2312ToUtf8(s []byte) ([]byte, error)

Gb2312ToUtf8 gb2312->utf8

func GbkToUtf8

func GbkToUtf8(s []byte) ([]byte, error)

GbkToUtf8 gbk->utf8

func New

func New(globalConfig define.Config, taskConfig define.TaskConfig) define.Task

New :

func Nochange

func Nochange(s []byte) ([]byte, error)

Nochange 无转换

Types

type Event

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

func NewTrapEvent

func NewTrapEvent(tasks define.Task) *Event

type EventCounter

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

type Gather

type Gather struct {
	tasks.BaseTask
	// contains filtered or unexported fields
}

Gather :

func (*Gather) Run

func (g *Gather) Run(ctx context.Context, e chan<- define.Event)

Run :

func (*Gather) TrapHandler

func (g *Gather) TrapHandler(packet *gosnmp.SnmpPacket, addr *net.UDPAddr)

TrapHandler 处理主逻辑

type OutputData

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

func (*OutputData) AsMapStr

func (o *OutputData) AsMapStr() common.MapStr

func (*OutputData) GetType

func (o *OutputData) GetType() string

func (*OutputData) IgnoreCMDBLevel

func (o *OutputData) IgnoreCMDBLevel() bool

IgnoreCMDBLevel :

type Sender

type Sender struct {
	tasks.CmdbEventSender

	Period      time.Duration
	IsAggregate bool

	Label []configs.Label // 配置的labels
	// contains filtered or unexported fields
}

func NewSender

func NewSender(period time.Duration, isAggregate bool, output chan<- define.Event, ctx context.Context) *Sender

func (*Sender) Run

func (s *Sender) Run()

func (*Sender) SetInput

func (s *Sender) SetInput(input chan *Event)

func (*Sender) SetOutput

func (s *Sender) SetOutput(output chan define.Event)

func (*Sender) Stop

func (s *Sender) Stop()

Jump to

Keyboard shortcuts

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