2 * collectd - src/plugin.h
3 * Copyright (C) 2005,2006 Florian octo Forster
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * Florian octo Forster <octo at verplant.org>
31 * Sets the current `plugindir'
34 * `dir' Path to the plugin directory
37 * If `dir' is NULL the compiled in default `PLUGINDIR' is used.
39 void plugin_set_dir (const char *dir);
49 * The number of currently loaded plugins
51 int plugin_count (void);
61 * `type' Name of the plugin.
64 * Returns non-zero if a plugin with the name $type is found and zero
67 int plugin_exists (char *type);
74 * Searches the current `plugindir' (see `plugin_set_dir') for the plugin
75 * named $type and loads it. Afterwards the plugin's `module_register'
76 * function is called, which then calls `plugin_register' to register callback
80 * `type' Name of the plugin to load.
83 * Returns zero upon success, a value greater than zero if no plugin was found
84 * and a value below zero if an error occurs.
87 * No attempt is made to re-load an already loaded module.
89 int plugin_load (const char *type);
91 int plugin_load_all (char *dir);
92 void plugin_init_all (void);
93 void plugin_read_all (void);
95 void plugin_register (char *type,
98 void (*write) (char *, char *, char *));
105 * Searches the plugin for `type' in the plugin-list. If found, and a `write'
106 * function is registered, it's called. If either the plugin is not found or
107 * the plugin doesn't provide a `write' function this function will return
108 * without further notice.
111 * `host' Host(name) from which the data originates.
112 * `type' Name of the plugin.
113 * `inst' Instance (passed to the plugin's `write' function.
114 * `val' Values for the RRD files. Also passed to the plugin.
116 void plugin_write (char *host, char *type, char *inst, char *val);
118 void plugin_submit (char *type, char *inst, char *val);
120 #endif /* PLUGIN_H */