remove plugin versions

This commit is contained in:
Olaf Rempel 2006-08-26 13:43:03 +02:00
parent f437881d52
commit e0c7daa6e9
16 changed files with 13 additions and 27 deletions

View File

@ -12,7 +12,7 @@ static int pos = 0;
static char *hostname = NULL;
void net_submit(char *plugin, int version, char *filename, int ds_id, char *data)
void net_submit(char *plugin, char *filename, int ds_id, char *data)
{
int len = 0;
@ -32,8 +32,8 @@ void net_submit(char *plugin, int version, char *filename, int ds_id, char *data
pos += len;
}
len = snprintf(pktbuf + pos, MAX_SIZE - pos, "%s:%d:%s:%d %s\n",
plugin, version, filename, ds_id, data);
len = snprintf(pktbuf + pos, MAX_SIZE - pos, "%s:%s:%d %s\n",
plugin, filename, ds_id, data);
if (len < 0 || len >= MAX_SIZE - pos)
return;

View File

@ -1,7 +1,7 @@
#ifndef _NETWORK_H_
#define _NETWORK_H_
void net_submit(char *plugin, int version, char *filename, int ds_id, char *data);
void net_submit(char *plugin, char *filename, int ds_id, char *data);
void net_commit();
#endif /* _NETWORK_H_ */

View File

@ -101,7 +101,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "ctstat",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -64,7 +64,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "load",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -119,7 +119,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "memory",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -103,7 +103,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "mount",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -90,7 +90,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "netdev",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -62,7 +62,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "random",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -125,7 +125,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "rtstat",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -138,7 +138,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "stat",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -63,7 +63,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "uptime",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -95,7 +95,6 @@ static void probe(void)
struct sammler_plugin plugin = {
.name = "vmstat",
.version = 1,
.probe = &probe,
.get_ds = &get_ds,
};

View File

@ -77,7 +77,7 @@ static void plugin_load(char *filename)
return;
}
log_print(LOG_INFO, "Plugin '%s' (v%d) loaded", plugin->name, plugin->version);
log_print(LOG_INFO, "Plugin '%s' loaded", plugin->name);
list_add_tail(&plugin->list, &plugin_list);
@ -109,16 +109,13 @@ void plugins_probe(void)
net_commit();
}
char ** plugins_get_ds(char *name, int version, int ds_id)
char ** plugins_get_ds(char *name, int ds_id)
{
struct sammler_plugin *plugin;
list_for_each_entry(plugin, &plugin_list, list) {
if (strcmp(plugin->name, name))
continue;
if (plugin->version != version)
continue;
return plugin->get_ds(ds_id);
}
return NULL;
@ -146,8 +143,8 @@ void probe_submit(struct sammler_plugin *plugin, char *filename, int ds_id, cons
return;
}
// rrd_submit(plugin->name, plugin->version, filename, ds_id, buffer);
net_submit(plugin->name, plugin->version, filename, ds_id, buffer);
// rrd_submit(plugin->name, filename, ds_id, buffer);
net_submit(plugin->name, filename, ds_id, buffer);
free(buffer);
}

View File

@ -7,7 +7,6 @@
struct sammler_plugin {
struct list_head list;
char *name;
int version;
void (*probe) (void);
char ** (*get_ds) (int ds_id);
};
@ -16,7 +15,7 @@ void plugin_load_all(void);
void plugins_probe(void);
char ** plugins_get_ds(char *plugin, int version, int ds_id);
char ** plugins_get_ds(char *plugin, int ds_id);
void probe_submit(struct sammler_plugin *plugin, char *filename, int ds_id, const char *fmt, ... );

View File

@ -254,7 +254,7 @@ static int create_parent_dirs(char *filename)
return 0;
}
void rrd_submit(char *plugin, int version, char *filename, int ds_id, char *data)
void rrd_submit(char *plugin, char *filename, int ds_id, char *data)
{
struct stat statbuf;
static char *rrd_dir = NULL;
@ -287,9 +287,9 @@ void rrd_submit(char *plugin, int version, char *filename, int ds_id, char *data
return;
}
ds_def = plugins_get_ds(plugin, version, ds_id);
ds_def = plugins_get_ds(plugin, ds_id);
if (ds_def == NULL) {
log_print(LOG_ERROR, "No vaild DS found (%s v%d %d)", plugin, version, ds_id);
log_print(LOG_ERROR, "No vaild DS found (%s:%d)", plugin, ds_id);
free(fullfile);
return;
}

View File

@ -1,6 +1,6 @@
#ifndef _RRDTOOL_H_
#define _RRDTOOL_H_
void rrd_submit(char *plugin, int version, char *filename, int ds_id, char *data);
void rrd_submit(char *plugin, char *filename, int ds_id, char *data);
#endif /* _RRDTOOL_H_ */