Documentation ¶
Index ¶
- func NewDatapoint(point *JSONWriteFormat, index uint, defaultDimensions map[string]string) *datapoint.Datapoint
- func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event
- func SetupCollectdPaths(r *mux.Router, handler http.Handler, endpoint string)
- type JSONDecoder
- type JSONWriteBody
- type JSONWriteFormat
- type ListenerConfig
- type ListenerServer
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
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) 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