Documentation
¶
Index ¶
- Variables
- type MetricSet
- type MetricSeter
- type Module
- type ModuleConfig
- type Moduler
- type Register
- func (r *Register) AddMetricSeter(module string, name string, new func() MetricSeter)
- func (r *Register) AddModuler(name string, m func() Moduler)
- func (r *Register) GetMetricSet(module *Module, metricsetName string) (*MetricSet, error)
- func (r *Register) GetModule(cfg *common.Config) (*Module, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Registry = Register{}
TODO: Global variables should be prevent.
This should be moved into the metricbeat object but can't because the init() functions in each metricset are called before the beater object exists.
Functions ¶
This section is empty.
Types ¶
type MetricSet ¶
type MetricSet struct {
Name string
MetricSeter MetricSeter
// Inherits config from module
Config ModuleConfig
Module *Module
// contains filtered or unexported fields
}
Metric specific data This must be defined by each metric
func NewMetricSet ¶
func NewMetricSet(name string, new func() MetricSeter, module *Module) (*MetricSet, error)
Creates a new MetricSet
type MetricSeter ¶
type MetricSeter interface {
// Setup of MetricSeter
// MetricSet which contains the MetricSeter is passed. This gives access to config
// and the module.
Setup(ms *MetricSet) error
// Method to periodically fetch a new event from a host
// Fetch is called for each host. In case where host does not exist, it can be transferred
// differently in the setup to have a different meaning. An example here is for filesystem
// of topbeat, where each host could be a filesystem.
// Fetch is called on the predefined interval and does not take delays into account.
Fetch(ms *MetricSet, host string) (common.MapStr, error)
}
Interface for each metric
type Module ¶
type Module struct {
// Module config
Config ModuleConfig
Timeout time.Duration
Publish chan common.MapStr
// contains filtered or unexported fields
}
Module specifics. This must be defined by each module
func (*Module) FetchMetricSets ¶
func (*Module) ProcessConfig ¶
ProcessConfig allows to process additional configuration params which are not part of the module default configuratoin. This allows each metricset to have its specific config params
type ModuleConfig ¶
type ModuleConfig struct {
Hosts []string `config:"hosts"`
Period string `config:"period"`
Timeout string `config:"timeout"`
Module string `config:"module"`
MetricSets []string `config:"metricsets"`
Enabled bool `config:"enabled"`
Selectors []string `config:"selectors"`
common.EventMetadata `config:",inline"` // Fields and tags to add to events.
}
Base configuration for each module/metricsets combination
type Moduler ¶
type Moduler interface {
// Raw *common.Config config is passed. This allows each module to extract its own local config variables
Setup(m *Module) error
}
Interface for each module
type Register ¶
type Register struct {
Modulers map[string]func() Moduler
MetricSeters map[string]map[string]func() MetricSeter
}
func (*Register) AddMetricSeter ¶
func (r *Register) AddMetricSeter(module string, name string, new func() MetricSeter)
func (*Register) AddModuler ¶
AddModule registers the given module with the registry
func (*Register) GetMetricSet ¶
GetMetricSet returns a new metricset instance for the given metricset name combined with the module name
Click to show internal directories.
Click to hide internal directories.