collectd

package
v3.8.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2018 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Errored       = "errored"
	Restarting    = "restarting"
	Running       = "running"
	Starting      = "starting"
	Stopped       = "stopped"
	ShuttingDown  = "shutting-down"
	Uninitialized = "uninitialized"
)

Collectd states

Variables

This section is empty.

Functions

func ConfigureMainCollectd

func ConfigureMainCollectd(conf *config.CollectdConfig) error

ConfigureMainCollectd should be called whenever the main collectd config in the agent has changed. Restarts collectd if the config has changed.

func InjectTemplateFuncs

func InjectTemplateFuncs(tmpl *template.Template) *template.Template

InjectTemplateFuncs injects some helper functions into our templates.

func MakePath

func MakePath(components ...string) string

MakePath takes file path components below the BundleDirectory/plugins/collectd path and returns an os appropriate file path. The environment variable SIGNALFX_BUNDLE_DIR is used as the root of the path

func RenderValue

func RenderValue(templateText string, context interface{}) (string, error)

RenderValue renders a template value

func WriteConfFile

func WriteConfFile(content, filePath string) error

WriteConfFile writes a file to the given filePath, ensuring that the containing directory exists.

Types

type Manager

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

Manager coordinates the collectd conf file and running the embedded collectd library.

func InitCollectd

func InitCollectd(conf *config.CollectdConfig) *Manager

InitCollectd makes a new instance of a manager and initializes it, but does not start collectd

func MainInstance

func MainInstance() *Manager

MainInstance returns the global singleton instance of the collectd manager

func (*Manager) Config

func (cm *Manager) Config() *config.CollectdConfig

Config returns the collectd config used by this instance of collectd manager

func (*Manager) ConfigureFromMonitor

func (cm *Manager) ConfigureFromMonitor(monitorID types.MonitorID, output types.Output, usesGenericJMX bool) error

ConfigureFromMonitor is how monitors notify the collectd manager that they have added a configuration file to managed_config and need a restart. The monitorID is passed in so that we can keep track of what monitors are actively using collectd. When a monitor is done (i.e. shutdown) it should call MonitorDidShutdown. GenericJMX monitors should set usesGenericJMX to true so that collectd can know to load the java plugin in the collectd.conf file so that any JVM config doesn't get set multiple times and cause spurious log output.

func (*Manager) ManagedConfigDir

func (cm *Manager) ManagedConfigDir() string

ManagedConfigDir returns the directory where monitor config should go.

func (*Manager) MonitorDidShutdown

func (cm *Manager) MonitorDidShutdown(monitorID types.MonitorID)

MonitorDidShutdown should be called by any monitor that uses collectd when it is shutdown.

func (*Manager) PluginDir

func (cm *Manager) PluginDir() string

PluginDir returns the base directory that holds both C and Python plugins.

func (*Manager) RequestRestart

func (cm *Manager) RequestRestart()

RequestRestart should be used to indicate that a configuration in managed_config has been updated (e.g. by a monitor) and that collectd needs to restart. This method will not immediately restart but will wait for a bit to batch together multiple back-to-back restarts.

func (*Manager) WriteServerURL

func (cm *Manager) WriteServerURL() string

WriteServerURL returns the URL of the write server, in case monitors need to know it (e.g. the signalfx-metadata plugin).

type MonitorCore

type MonitorCore struct {
	Template *template.Template
	Output   types.Output

	UsesGenericJMX bool
	// contains filtered or unexported fields
}

MonitorCore contains common data/logic for collectd monitors, mainly stuff related to templating of the plugin config files. This should generally not be used directly, but rather one of the structs that embeds this: StaticMonitorCore or ServiceMonitorCore.

func NewMonitorCore

func NewMonitorCore(template *template.Template) *MonitorCore

NewMonitorCore creates a new initialized but unconfigured MonitorCore with the given template.

func (*MonitorCore) Init

func (bm *MonitorCore) Init() error

Init generates a unique file name for each distinct monitor instance

func (*MonitorCore) RemoveConfFile

func (bm *MonitorCore) RemoveConfFile()

RemoveConfFile deletes the collectd config file for this monitor

func (*MonitorCore) SetCollectdInstance

func (bm *MonitorCore) SetCollectdInstance(instance *Manager)

SetCollectdInstance allows you to override the instance of collectd used by this monitor

func (*MonitorCore) SetConfiguration

func (bm *MonitorCore) SetConfiguration(conf config.MonitorCustomConfig) error

SetConfiguration adds various fields from the config to the template context but does not render the config.

func (*MonitorCore) SetConfigurationAndRun

func (bm *MonitorCore) SetConfigurationAndRun(conf config.MonitorCustomConfig) error

SetConfigurationAndRun sets the configuration to be used when rendering templates, and writes config before queueing a collectd restart.

func (*MonitorCore) Shutdown

func (bm *MonitorCore) Shutdown()

Shutdown removes the config file and restarts collectd

func (*MonitorCore) WriteConfigForPlugin

func (bm *MonitorCore) WriteConfigForPlugin() error

WriteConfigForPlugin will render the config template to the filesystem and queue a collectd restart

type WriteHTTPServer

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

WriteHTTPServer is a reimplementation of what the metricproxy collectd endpoint does. The main difference from metric proxy is that we propagate the meta field from collectd datapoints onto the resulting datapoints so that we can correlate metrics from collectd to specific monitors in the agent. The server will run on the configured localhost port.

func NewWriteHTTPServer

func NewWriteHTTPServer(ipAddr string, port uint16,
	dpCallback func([]*datapoint.Datapoint), eventCallback func([]*event.Event)) (*WriteHTTPServer, error)

NewWriteHTTPServer creates but does not start a new write server

func (*WriteHTTPServer) RunningPort

func (s *WriteHTTPServer) RunningPort() int

RunningPort returns the TCP port that the server is running on. Should not be called before the Start method is called.

func (*WriteHTTPServer) ServeHTTP

func (s *WriteHTTPServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP accepts collectd write_http requests and sends the resulting datapoint/events to the configured callback functions.

func (*WriteHTTPServer) Shutdown

func (s *WriteHTTPServer) Shutdown() error

Shutdown stops the write server immediately

func (*WriteHTTPServer) Start

func (s *WriteHTTPServer) Start() error

Start begins accepting connections on the write server. Will return an error if it cannot bind to the configured port.

Directories

Path Synopsis
Package activemq has an ActiveMQ Collectd monitor that uses GenericJMX
Package activemq has an ActiveMQ Collectd monitor that uses GenericJMX
Package custom contains a custom collectd plugin monitor, for which you can specify your own config template and parameters.
Package custom contains a custom collectd plugin monitor, for which you can specify your own config template and parameters.
Package genericjmx coordinates the various monitors that rely on the GenericJMX Collectd plugin to pull JMX metrics.
Package genericjmx coordinates the various monitors that rely on the GenericJMX Collectd plugin to pull JMX metrics.
Package netinterface wraps the "interface" collectd plugin for gather network interface metrics.
Package netinterface wraps the "interface" collectd plugin for gather network interface metrics.

Jump to

Keyboard shortcuts

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