collectd.org

module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: ISC

README

go-collectd

Utilities for using collectd together with Go.

Synopsis

package main

import (
    "context"
    "time"
    
    "collectd.org/api"
    "collectd.org/exec"
)

func main() {
    vl := api.ValueList{
        Identifier: api.Identifier{
            Host:   exec.Hostname(),
            Plugin: "golang",
            Type:   "gauge",
        },
        Time:     time.Now(),
        Interval: exec.Interval(),
        Values:   []api.Value{api.Gauge(42)},
    }
    exec.Putval.Write(context.Background(), &vl)
}

Description

This is a very simple package and very much a Work in Progress, so expect things to move around and be renamed a lot.

The repository is organized as follows:

  • Package collectd.org/api declares data structures you may already know from the collectd source code itself, such as ValueList.
  • Package collectd.org/exec declares some utilities for writing binaries to be executed with the exec plugin. It provides some utilities (getting the hostname, e.g.) and an executor which you may use to easily schedule function calls.
  • Package collectd.org/format declares functions for formatting ValueLists in other format. Right now, only PUTVAL is implemented. Eventually I plan to add parsers for some formats, such as the JSON export.
  • Package collectd.org/network implements collectd's binary network protocol. It offers client and server implementations, see network.Client and network.ListenAndWrite() for more details.

Install

To use this package in your own programs, simply use go get to fetch the packages you need, for example:

go get collectd.org/api

Author

Florian "octo" Forster <ff at octo.it>

Directories

Path Synopsis
Package api defines data types representing core collectd data types.
Package api defines data types representing core collectd data types.
Package cdtime implements methods to convert from and to collectd's internal time representation, cdtime_t.
Package cdtime implements methods to convert from and to collectd's internal time representation, cdtime_t.
Package config provides types that represent a plugin's configuration.
Package config provides types that represent a plugin's configuration.
Package exec implements tools to write plugins for collectd's "exec plugin" in Go.
Package exec implements tools to write plugins for collectd's "exec plugin" in Go.
Package export provides an interface to instrument Go code.
Package export provides an interface to instrument Go code.
Package format provides utilities to format metrics and notifications in various formats.
Package format provides utilities to format metrics and notifications in various formats.
Package meta provides data types for collectd meta data.
Package meta provides data types for collectd meta data.
Package network implements collectd's binary network protocol.
Package network implements collectd's binary network protocol.
Package plugin exports the functions required to write collectd plugins in Go.
Package plugin exports the functions required to write collectd plugins in Go.
fake
Package fake implements fake versions of the C functions imported from the collectd daemon for testing.
Package fake implements fake versions of the C functions imported from the collectd daemon for testing.
rpc
Package rpc implements an idiomatic Go interface to collectd's gRPC server.
Package rpc implements an idiomatic Go interface to collectd's gRPC server.
proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.
proto/types
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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