summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bea5daa)
raw | patch | inline | side by side (parent: bea5daa)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Sun, 24 Apr 2016 13:30:46 +0000 (19:30 +0600) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 10 Jul 2017 08:45:03 +0000 (15:45 +0700) |
src/collectd.conf.pod | patch | blob | history | |
src/tail_csv.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 9b31de7ec28d16324ba74f43048b2fef763271fb..3f7bb4129d346964477296d301732ba0a2351c48 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
Index 1
</Metric>
<File "/var/log/snort/snort.stats">
- Instance "snort-eth0"
+ PluginName "snortstats"
+ Instance "eth0"
Interval 600
Collect "snort-dropped"
</File>
=over 4
+=item B<PluginName> I<PluginName>
+
+Use I<PluginName> as the plugin name when submitting values.
+Defaults to 'tail_csv'.
+
=item B<Instance> I<PluginInstance>
Sets the I<plugin instance> used when dispatching the values.
diff --git a/src/tail_csv.c b/src/tail_csv.c
index d512a52ee8188aef675dc1e6378cd09147e508d3..498b4c1153f51ab290bb4a5ed30fa7c684600c49 100644 (file)
--- a/src/tail_csv.c
+++ b/src/tail_csv.c
typedef struct metric_definition_s metric_definition_t;
struct instance_definition_s {
+ char *plugin_name;
char *instance;
char *path;
cu_tail_t *tail;
vl.values_len = 1;
vl.values = &v;
- sstrncpy(vl.plugin, "tail_csv", sizeof(vl.plugin));
+ sstrncpy(vl.plugin, (id->plugin_name != NULL) ? id->plugin_name : "tail_csv",
+ sizeof(vl.plugin));
if (id->instance != NULL)
sstrncpy(vl.plugin_instance, id->instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, md->type, sizeof(vl.type));
cu_tail_destroy(id->tail);
id->tail = NULL;
+ sfree(id->plugin_name);
sfree(id->instance);
sfree(id->path);
sfree(id->metric_list);
id = calloc(1, sizeof(*id));
if (id == NULL)
return -1;
+ id->plugin_name = NULL;
id->instance = NULL;
id->path = NULL;
id->metric_list = NULL;
cf_util_get_cdtime(option, &id->interval);
else if (strcasecmp("TimeFrom", option->key) == 0)
status = tcsv_config_get_index(option, &id->time_from);
+ else if (strcasecmp("PluginName", option->key) == 0)
+ status = cf_util_get_string(option, &id->plugin_name);
else {
WARNING("tail_csv plugin: Option `%s' not allowed here.", option->key);
status = -1;