|
|
|
@ -81,8 +81,14 @@ static int do_rrd(int (*rrd_func)(int, char **), char *cmd)
|
|
|
|
|
return retval;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int rrd_create_file(const char *filename, struct sammler_plugin *plugin, int ds_id)
|
|
|
|
|
static int rrd_create_file(const char *filename, const char *pluginname, int ds_id)
|
|
|
|
|
{
|
|
|
|
|
struct sammler_plugin *plugin = plugin_lookup(pluginname);
|
|
|
|
|
if (plugin == NULL) {
|
|
|
|
|
log_print(LOG_ERROR, "rrd_create_file: plugin not found (%s)", pluginname);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *ds_def = plugin->get_ds(ds_id);
|
|
|
|
|
if (ds_def == NULL) {
|
|
|
|
|
log_print(LOG_ERROR, "No vaild DS found (%s:%d)", plugin->name, ds_id);
|
|
|
|
@ -91,7 +97,7 @@ static int rrd_create_file(const char *filename, struct sammler_plugin *plugin,
|
|
|
|
|
|
|
|
|
|
char *buffer = malloc(ARGVSIZE);
|
|
|
|
|
if (buffer == NULL) {
|
|
|
|
|
log_print(LOG_ERROR, "append_ds_config: out of memory");
|
|
|
|
|
log_print(LOG_ERROR, "rrd_create_file: out of memory");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -193,7 +199,7 @@ static int create_parent_dirs(char *filename)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rrd_submit(const char *hostname, struct sammler_plugin *plugin, const char *filename, int ds_id, const char *data)
|
|
|
|
|
int rrd_submit(const char *hostname, const char *pluginname, const char *filename, int ds_id, const char *data)
|
|
|
|
|
{
|
|
|
|
|
static const char *rrd_dir = NULL;
|
|
|
|
|
if (rrd_dir == NULL)
|
|
|
|
@ -222,7 +228,7 @@ int rrd_submit(const char *hostname, struct sammler_plugin *plugin, const char *
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (rrd_create_file(fullfile, plugin, ds_id) == -1) {
|
|
|
|
|
if (rrd_create_file(fullfile, pluginname, ds_id) == -1) {
|
|
|
|
|
free(fullfile);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|