erlang plugin: Make dispatching values possible.
[collectd.git] / bindings / erlang / collectd.erl
diff --git a/bindings/erlang/collectd.erl b/bindings/erlang/collectd.erl
new file mode 100644 (file)
index 0000000..f4b31c6
--- /dev/null
@@ -0,0 +1,17 @@
+-module(collectd).
+-export([dispatch_values/1]).
+
+-include("collectd.hrl").
+
+dispatch_values (VL) when is_record (VL, value_list) ->
+       call_cnode (dispatch_values, VL).
+
+call_cnode(Func, Args) ->
+       {any, 'collectd@leeloo.lan.home.verplant.org'} ! {Func, Args},
+       receive
+               { error, Message } ->
+                       io:format ("Function ~w failed: ~s~n", [Func, Message]),
+                       error;
+               success ->
+                       success
+       end.