collectd

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDatapoint

func NewDatapoint(point *JSONWriteFormat, index uint, defaultDimensions map[string]string) *datapoint.Datapoint

NewDatapoint creates a new datapoint from collectd's write_http endpoint JSON format defaultDimensions are added to the datapoint created, but will be overridden by any dimension values in the JSON Dimensions are pulled out of type_instance, plugin_instance and host in that order of precedence

func NewEvent added in v0.7.0

func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event

NewEvent creates a new event from collectd's write_http endpoint JSON format defaultDimensions are added to the event created, but will be overridden by any dimension values in the JSON

func SetupCollectdPaths added in v0.9.0

func SetupCollectdPaths(r *mux.Router, handler http.Handler, endpoint string)

SetupCollectdPaths tells the router which paths the given handler (which should handle collectd json) should see

Types

type JSONDecoder

type JSONDecoder struct {
	SendTo      dpsink.Sink
	DefaultDims map[string]string

	TotalErrors    int64
	TotalBlankDims int64
}

JSONDecoder can decode collectd's native JSON datapoint format

func (*JSONDecoder) Datapoints added in v0.9.0

func (decoder *JSONDecoder) Datapoints() []*datapoint.Datapoint

Datapoints about this decoder, including how many datapoints it decoded

func (*JSONDecoder) Read

func (decoder *JSONDecoder) Read(ctx context.Context, req *http.Request) error

func (*JSONDecoder) ServeHTTPC

func (decoder *JSONDecoder) ServeHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request)

ServeHTTPC decodes datapoints for the connection and sends them to the decoder's sink

type JSONWriteBody

type JSONWriteBody []*JSONWriteFormat

JSONWriteBody is the full POST body of collectd's write_http format

type JSONWriteFormat

type JSONWriteFormat struct {
	Dsnames        []*string  `json:"dsnames"`
	Dstypes        []*string  `json:"dstypes"`
	Host           *string    `json:"host"`
	Interval       *float64   `json:"interval"`
	Plugin         *string    `json:"plugin"`
	PluginInstance *string    `json:"plugin_instance"`
	Time           *float64   `json:"time"`
	TypeS          *string    `json:"type"`
	TypeInstance   *string    `json:"type_instance"`
	Values         []*float64 `json:"values"`
	// events
	Message  *string                `json:"message"`
	Meta     map[string]interface{} `json:"meta"`
	Severity *string                `json:"severity"`
}

JSONWriteFormat is the format for collectd json datapoints

type ListenerConfig added in v0.9.0

type ListenerConfig struct {
	ListenAddr        *string
	ListenPath        *string
	Timeout           *time.Duration
	DefaultDimensions map[string]string
	StartingContext   context.Context
}

ListenerConfig controls optional parameters for collectd listeners

type ListenerServer

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

ListenerServer will listen for collectd datapoint connections

func NewListener added in v0.9.0

func NewListener(sink dpsink.Sink, passedConf *ListenerConfig) (*ListenerServer, error)

NewListener servers http collectd requests

func (*ListenerServer) Close

func (s *ListenerServer) Close() error

Close the socket currently open for collectd JSON connections

func (*ListenerServer) Datapoints added in v0.9.0

func (s *ListenerServer) Datapoints() []*datapoint.Datapoint

Datapoints returns JSON decoder datapoints

Jump to

Keyboard shortcuts

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