plugin

package
v2.0.0-...-435c7d3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPluginInterval = 30 * time.Minute
View Source
const DefaultPollInterval = 3 * time.Minute

Variables

This section is empty.

Functions

func GetInterval

func GetInterval(param *node.Node, defaultInterval time.Duration) float64

func RegisterModule

func RegisterModule(instance Module)

Types

type AbstractPlugin

type AbstractPlugin struct {
	Parent               string           // name of the collector that owns this plugin
	Name                 string           // name of the plugin
	Object               string           // object of the collector, describes what that collector is collecting
	SLogger              *slog.Logger     // logger used for logging
	Options              *options.Options // poller options
	Params               *node.Node       // plugin parameters
	ParentParams         *node.Node       // parent collector parameters
	PluginInvocationRate int
	Auth                 *auth.Credentials
}

AbstractPlugin implements methods of the Plugin interface, except Run()

func New

func New(parent string, o *options.Options, p *node.Node, pp *node.Node, object string, credentials *auth.Credentials) *AbstractPlugin

New creates an AbstractPlugin

func (*AbstractPlugin) GetName

func (p *AbstractPlugin) GetName() string

GetName returns the name of the plugin

func (*AbstractPlugin) Init

func (p *AbstractPlugin) Init(conf.Remote) error

Init initializes the plugin by calling InitAbc

func (*AbstractPlugin) InitAbc

func (p *AbstractPlugin) InitAbc() error

InitAbc initializes the plugin

func (*AbstractPlugin) Run

Run should run the plugin and return collected data as an array of matrices (Since most plugins don't collect data, they will always return nil instead)

func (*AbstractPlugin) SetPluginInterval

func (p *AbstractPlugin) SetPluginInterval() int

type DerivedMetric

type DerivedMetric struct {
	Name   string
	Source string
	IsMax  bool
}

type Module

type Module interface {
	HarvestModule() ModuleInfo
}

type ModuleInfo

type ModuleInfo struct {
	// name of module
	ID string

	New func() Module
}

func GetModule

func GetModule(name string) (ModuleInfo, error)

GetModule returns module information from its ID (full name).

type Plugin

type Plugin interface {
	GetName() string
	Init(conf.Remote) error
	Run(map[string]*matrix.Matrix) ([]*matrix.Matrix, *util.Metadata, error)
}

Plugin defines the methods of a plugin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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