plugin

package
v0.0.0-...-d56806e Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

DC/OS Metrics Service Plugins

DC/OS Metrics Plugins are the best way to get your metrics from DC/OS to your monitoring platform.

Plugins are binaries which you run on each node in your DC/OS cluster. There they monitor the DC/OS Metrics API, aggregating, transforming, and pushing or offering them as appropriate.

The following plugins are available for use:

  • Datadog - sends your metrics straight to DatadogHQ
  • Librato - sends your metrics to Librato
  • Prometheus - serves prometheus-format metrics (DC/OS 1.9 and 1.10 only)

The following plugins are not recommended for production use:

  • Datadog Agent - deprecated, sends your metrics to the Datadog Agent
  • StatsD - experimental, sends your metrics to a StatsD server
  • stdout - for debugging only, prints your metrics to stdout

Missing a plugin? You can get in touch with the team and ask us to write a new one, or you can write your own.

Installation

Plugins can be installed on each node.

The prebuilt binaries are linked from the README or can be built from source according to preference. The binary should be copied to the /opt/mesosphere/bin directory on each node.

Each plugin has (or will soon have) a systemd directory containing systemd unit files for the master and agent. These should be downloaded, edited as appropriate - each plugin has its own flags where you may need to define API keys or make customisations - and then uploaded to the /etc/systemd/system` directory on each node.

This done, the new systemd service should be added and started (systemctl daemon-reload && systemctl start <plugin>)

Compatibility

Regardless of the release to which they are attached, all plugins are compatible with DC/OS 1.9 and above.

The future

In 1.11, a new and improved metrics API will be available which should make plugins much easier to write and install.

When that happens, the plugins that reside in this directory will be deprecated. They will continue to work. New plugins using the updated API will be developed and released to replace them.

In later versions of DC/OS, we expect these plugins to cease to function as the API on which they depend will no longer be available.

Developing

See CONTRIBUTING.md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatapointValueToFloat64

func DatapointValueToFloat64(value interface{}) (float64, error)

DatapointValueToFloat64 converts a Datapoint's Value from an interface{} to a float64.

func ParseDatapointTimestamp

func ParseDatapointTimestamp(timestamp string) (*time.Time, error)

ParseDatapointTimestamp parses an RFC3339 timestamp to a *time.Time

Types

type Option

type Option func(*Plugin) error

Option lets each plugin configure the Plugin type. The plugin.New(...) method will call each supplied Option before returning the initialized Plugin.

func ConnectorFunc

func ConnectorFunc(connect func([]producers.MetricsMessage, *cli.Context) error) Option

ConnectorFunc is what the plugin framework will call once it has gathered metrics. It is expected that this function will convert these messages to a 3rd party format and then send the metrics to that service.

func ExtraFlags

func ExtraFlags(extraFlags []cli.Flag) Option

ExtraFlags sets additional cli.Flag's on the Plugin

func Name

func Name(n string) Option

Name allows the plugin to set a custom name for itself.

func PollingInterval

func PollingInterval(i int) Option

PollingInterval sets the polling interval to the supplied value.

type Plugin

type Plugin struct {
	App             *cli.App
	Name            string
	Endpoints       []string
	Role            string
	PollingInterval int
	Log             *logrus.Entry
	ConnectorFunc   func([]producers.MetricsMessage, *cli.Context) error
	BeforeFunc      func(*cli.Context) error
	AfterFunc       func(*cli.Context) error
	Client          *http.Client
}

Plugin is used to collect metrics and then send them to a remote system (e.g. DataDog, Librato, etc.). Use plugin.New(...) to build a new plugin.

func New

func New(options ...Option) (*Plugin, error)

New returns a mandatory plugin config which every plugin for metrics will need

func (*Plugin) Metrics

func (p *Plugin) Metrics() ([]producers.MetricsMessage, error)

Metrics queries the local dcos-metrics API and returns a slice of producers.MetricsMessage.

func (*Plugin) StartPlugin

func (p *Plugin) StartPlugin() error

StartPlugin starts a (previously configured) Plugin. It will periodically poll the system for metrics and send them to the ConnectorFunc. This method will block.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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