5 * collectd - src/plugin.h
6 * Copyright (C) 2005,2006 Florian octo Forster
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 * Florian octo Forster <octo at verplant.org>
29 typedef struct complain_s
31 unsigned int interval; /* how long we wait for reporting this error again */
32 unsigned int delay; /* how many more iterations we still need to wait */
40 * Sets the current `plugindir'
43 * `dir' Path to the plugin directory
46 * If `dir' is NULL the compiled in default `PLUGINDIR' is used.
48 void plugin_set_dir (const char *dir);
58 * The number of currently loaded plugins
60 int plugin_count (void);
70 * `type' Name of the plugin.
73 * Returns non-zero if a plugin with the name $type is found and zero
76 int plugin_exists (char *type);
83 * Searches the current `plugindir' (see `plugin_set_dir') for the plugin
84 * named $type and loads it. Afterwards the plugin's `module_register'
85 * function is called, which then calls `plugin_register' to register callback
89 * `type' Name of the plugin to load.
92 * Returns zero upon success, a value greater than zero if no plugin was found
93 * and a value below zero if an error occurs.
96 * No attempt is made to re-load an already loaded module.
98 int plugin_load (const char *type);
100 int plugin_load_all (char *dir);
101 void plugin_init_all (void);
102 void plugin_read_all (const int *loop);
104 void plugin_shutdown_all (void);
106 void plugin_register (char *type,
109 void (*write) (char *, char *, char *));
111 int plugin_register_shutdown (char *, void (*) (void));
118 * Searches the plugin for `type' in the plugin-list. If found, and a `write'
119 * function is registered, it's called. If either the plugin is not found or
120 * the plugin doesn't provide a `write' function this function will return
121 * without further notice.
124 * `host' Host(name) from which the data originates.
125 * `type' Name of the plugin.
126 * `inst' Instance (passed to the plugin's `write' function.
127 * `val' Values for the RRD files. Also passed to the plugin.
129 void plugin_write (char *host, char *type, char *inst, char *val);
131 void plugin_submit (char *type, char *inst, char *val);
134 void plugin_complain (int level, complain_t *c, const char *format, ...);
135 void plugin_relief (int level, complain_t *c, const char *format, ...);
137 #endif /* PLUGIN_H */