File: README.md

package info (click to toggle)
golang-collectd 0.3.0+git20181025.f80706d-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 312 kB
  • sloc: makefile: 3
file content (61 lines) | stat: -rw-r--r-- 1,905 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# go-collectd

Utilities for using [collectd](https://collectd.org/) together with [Go](http://golang.org/).

# 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](https://collectd.org/wiki/index.php/Binary_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>