diff --git a/network.c b/network.c index 416ac83..516a302 100644 --- a/network.c +++ b/network.c @@ -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; diff --git a/network.h b/network.h index eeee136..d6e28b4 100644 --- a/network.h +++ b/network.h @@ -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_ */ diff --git a/p_ctstat.c b/p_ctstat.c index 80354bc..4a998ba 100644 --- a/p_ctstat.c +++ b/p_ctstat.c @@ -101,7 +101,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "ctstat", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_load.c b/p_load.c index 9876f15..48ce532 100644 --- a/p_load.c +++ b/p_load.c @@ -64,7 +64,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "load", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_memory.c b/p_memory.c index 8115236..479afe6 100644 --- a/p_memory.c +++ b/p_memory.c @@ -119,7 +119,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "memory", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_mount.c b/p_mount.c index a85ee80..4eeb5bc 100644 --- a/p_mount.c +++ b/p_mount.c @@ -103,7 +103,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "mount", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_netdev.c b/p_netdev.c index eca0d79..7ec907c 100644 --- a/p_netdev.c +++ b/p_netdev.c @@ -90,7 +90,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "netdev", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_random.c b/p_random.c index 37a42c2..e8383de 100644 --- a/p_random.c +++ b/p_random.c @@ -62,7 +62,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "random", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_rtstat.c b/p_rtstat.c index 5b2899a..1886409 100644 --- a/p_rtstat.c +++ b/p_rtstat.c @@ -125,7 +125,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "rtstat", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_stat.c b/p_stat.c index b1bb038..ac8daf8 100644 --- a/p_stat.c +++ b/p_stat.c @@ -138,7 +138,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "stat", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_uptime.c b/p_uptime.c index 946b365..3160282 100644 --- a/p_uptime.c +++ b/p_uptime.c @@ -63,7 +63,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "uptime", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/p_vmstat.c b/p_vmstat.c index 8fcd009..7df9db7 100644 --- a/p_vmstat.c +++ b/p_vmstat.c @@ -95,7 +95,6 @@ static void probe(void) struct sammler_plugin plugin = { .name = "vmstat", - .version = 1, .probe = &probe, .get_ds = &get_ds, }; diff --git a/plugins.c b/plugins.c index 42a7342..c541b8a 100644 --- a/plugins.c +++ b/plugins.c @@ -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); } diff --git a/plugins.h b/plugins.h index c2e604d..5e49538 100644 --- a/plugins.h +++ b/plugins.h @@ -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, ... ); diff --git a/rrdtool.c b/rrdtool.c index 87bfed0..f9e5eaf 100644 --- a/rrdtool.c +++ b/rrdtool.c @@ -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; } diff --git a/rrdtool.h b/rrdtool.h index 047b7a4..d545e85 100644 --- a/rrdtool.h +++ b/rrdtool.h @@ -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_ */