1 % collectd - bindings/erlang/cexample.erl
2 % Copyright (C) 2009 Florian octo Forster
4 % This program is free software; you can redistribute it and/or modify it
5 % under the terms of the GNU General Public License as published by the
6 % Free Software Foundation; only version 2 of the License is applicable.
8 % This program is distributed in the hope that it will be useful, but
9 % WITHOUT ANY WARRANTY; without even the implied warranty of
10 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 % General Public License for more details.
13 % You should have received a copy of the GNU General Public License along
14 % with this program; if not, write to the Free Software Foundation, Inc.,
15 % 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 % Florian octo Forster <octo at verplant.org>
23 -include("collectd.hrl").
25 dispatch_reductions ({Total, _}) ->
26 collectd:dispatch_values (#value_list{host="localhost", plugin="erlang",
27 type="counter", type_instance="reductions",
30 dispatch_memory ({Type, Size}) ->
31 collectd:dispatch_values (#value_list{host="localhost", plugin="erlang",
32 type="memory", type_instance=atom_to_list (Type),
36 dispatch_reductions (statistics (reductions)),
37 lists:foreach (fun dispatch_memory/1, erlang:memory()),
41 collectd:register_read (fun my_read/0).