plugin

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 8 Imported by: 5

Documentation

Index

Constants

View Source
const (
	DefaultCapacity = 100
)

Variables

View Source
var Metrics map[string]*Metric = make(map[string]*Metric)
View Source
var Plugins map[string]Accessor = make(map[string]Accessor)
View Source
var UnsupportedMetricError error

Functions

func ClearRegistry

func ClearRegistry()

func ClearUserParamMetrics

func ClearUserParamMetrics() (metricsFallback map[string]*Metric)

func RegisterMetrics

func RegisterMetrics(impl Accessor, name string, params ...string)

func RestoreUserParamMetrics

func RestoreUserParamMetrics(metrics map[string]*Metric)

Types

type Accessor

type Accessor interface {
	Init(name string)
	Name() string
	Capacity() int
	SetCapacity(capactity int)
	IsExternal() bool
}

func Get

func Get(key string) (acc Accessor, err error)

func GetByName

func GetByName(name string) (acc Accessor, err error)

type Base

type Base struct {
	log.Logger
	// contains filtered or unexported fields
}

func (*Base) Capacity

func (b *Base) Capacity() int

func (*Base) Init

func (b *Base) Init(name string)

func (*Base) IsExternal

func (b *Base) IsExternal() bool

func (*Base) Name

func (b *Base) Name() string

func (*Base) SetCapacity

func (b *Base) SetCapacity(capacity int)

func (*Base) SetExternal

func (b *Base) SetExternal(isExternal bool)

type Collector

type Collector interface {
	Collect() error
	Period() int
}

Collector - interface for periodical metric collection

type Configurator

type Configurator interface {
	// Configure method passes global and private plugin configuration after it has been activated.
	Configure(globalOptions *GlobalOptions, privateOptions interface{})
	// Validate method validates private plugin configuration during agent startup.
	Validate(privateOptions interface{}) error
}

Configurator - interface for plugin configuration in agent conf files

type ContextProvider

type ContextProvider interface {
	ClientID() uint64
	ItemID() uint64
	Output() ResultWriter
	Meta() *Meta
	GlobalRegexp() RegexpMatcher
}

type Exporter

type Exporter interface {
	// Export method exports data based on the key 'key' and its parameters 'params'.
	Export(key string, params []string, context ContextProvider) (interface{}, error)
}

Exporter - interface for exporting collected metrics

type GlobalOptions

type GlobalOptions struct {
	Timeout  int
	SourceIP string
}

GlobalOptions are global agent configuration parameters that can be accessed by plugins. In most cases it's recommended to allow plugins overriding global configuration parameters they are using with plugin specific parameters.

type Meta

type Meta struct {
	Data interface{}
	// contains filtered or unexported fields
}

func (*Meta) LastLogsize

func (m *Meta) LastLogsize() uint64

func (*Meta) Mtime

func (m *Meta) Mtime() int32

func (*Meta) SetLastLogsize

func (m *Meta) SetLastLogsize(value uint64)

func (*Meta) SetMtime

func (m *Meta) SetMtime(value int32)

type Metric

type Metric struct {
	Plugin      Accessor
	Key         string
	Description string
	UsrPrm      bool
}

type RegexpMatcher

type RegexpMatcher interface {
	Match(value string, pattern string, mode int, output_template *string) (match bool, output string)
}

type Request

type Request struct {
	Itemid      uint64  `json:"itemid"`
	Key         string  `json:"key"`
	Delay       string  `json:"delay"`
	LastLogsize *uint64 `json:"lastlogsize"`
	Mtime       *int    `json:"mtime"`
}

type Result

type Result struct {
	Itemid uint64
	Value  *string

	// additional windows eventlog fields
	EventSource    *string
	EventID        *int
	EventTimestamp *int
	EventSeverity  *int

	Ts          time.Time
	Error       error
	LastLogsize *uint64
	Mtime       *int
	Persistent  bool
}

type ResultWriter

type ResultWriter interface {
	Write(result *Result)
	Flush()
	SlotsAvailable() int
	PersistSlotsAvailable() int
}

type Runner

type Runner interface {
	// Start method activates plugin.
	Start()
	// Stop method deactivates pluing.
	Stop()
}

Runner - interface for managing background processes

type SystemOptions

type SystemOptions struct {
	Path     string `conf:"optional"`
	Capacity string `conf:"optional"`
}

type Watcher

type Watcher interface {
	// Watch method instructs plugin to watch for events based on item configuration in 'requests'.
	Watch(requests []*Request, context ContextProvider)
}

Watcher - interface for fully custom monitoring

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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