bindings/erlang: Added README.
[collectd.git] / bindings / erlang / README
1 Erlang bindings for collectd
2 ============================
3 Welcome to the Erlang bindings for collectd. This is a quick introduction to
4 get you started.
5
6
7 collectd's Erlang plugin
8 ------------------------
9 In order to write collectd plugins in Erlang, you need to load the “Erlang”
10 plugin in collectd. The Erlang plugin will create a “C-node” which basically
11 behaves like a distributed Erlang node. This means you can send messages to
12 that note which it will process and reply with an appropriate message.
13
14 The first step is to start the “Erlang Port Mapper Daemon”, epmd. Without that
15 that daemon running, collectd will not be able to register itself as a node.
16
17 The collectd configuration looks somewhat like this:
18 -- 8< --
19  LoadPlugin "erlang"
20  <Plugin "erlang">
21    NodeName "collectd@example.collectd.org"
22    Cookie "worlddomination"
23  </Plugin>
24 -- >8 --
25
26
27 Starting a distributed Erlang node
28 ----------------------------------
29 The next step is to start a distributed Erlang node. This node has to use the
30 same “cookie” as the daemon in order to be able to communicate with it. The
31 node name should be something different though:
32
33   $ erl -name shell@example.collectd.org -setcookie worlddomination
34
35
36 Erlang's collectd module
37 ------------------------
38 The actual message passing is abstracted using the “collectd” module. It
39 currently provides the following functions:
40
41   * register_read/1
42     The argument must be a function reference (“fun”). This function is called
43     once every interval.
44
45   * dispatch_values/1
46     The function takes a record of the type “value_list” (see file
47     “collectd.hrl”) and sends it to the daemon.
48
49 Both functions return either the atom “success” upon success or
50 {error, Message} if an error occurred.
51
52
53 Status
54 ------
55 Currently the bindings are still very much work in progress. Configuration of
56 the Erlang module is not yet possible and only read callbacks can be registered
57 currently.
58
59
60 Author
61 ------
62 Erlang bindings for collectd have been written by Florian octo Forster.