summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ebf73b6)
raw | patch | inline | side by side (parent: ebf73b6)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Thu, 21 Sep 2017 06:24:14 +0000 (13:24 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Thu, 21 Sep 2017 06:24:14 +0000 (13:24 +0700) |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/table.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index fa6c96c1628d6c1fa8879f5750d5971da7b4415d..bbd3a15cb2ca3d77f108181aa794d71768745349 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
#<Plugin table>
# <Table "/proc/slabinfo">
+# #Plugin "table"
# Instance "slabinfo"
# Separator " "
# <Result>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 379e083878e905637952dce7450f950c8a997052..51f3467ac51206d58f61487562f1ec0603d2deaa 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
<Plugin table>
<Table "/proc/slabinfo">
+ #Plugin "slab"
Instance "slabinfo"
Separator " "
<Result>
=over 4
+=item B<Plugin> I<Plugin>
+
+If specified, I<Plugin> is used as the plugin name when submitting values.
+Defaults to B<table>.
+
=item B<Instance> I<instance>
-If specified, I<instance> is used as the plugin instance. So, in the above
-example, the plugin name C<table-slabinfo> would be used. If omitted, the
+If specified, I<instance> is used as the plugin instance. If omitted, the
filename of the table is used instead, with all special characters replaced
with an underscore (C<_>).
diff --git a/src/table.c b/src/table.c
index 578e019ee5b120c28369d00b3c038121ce26cb93..5fb51512ffb8ec1bb474d3f4b67d6a10e02ab9be 100644 (file)
--- a/src/table.c
+++ b/src/table.c
typedef struct {
char *file;
char *sep;
+ char *plugin_name;
char *instance;
tbl_result_t *results;
static void tbl_setup(tbl_t *tbl, char *file) {
tbl->file = sstrdup(file);
tbl->sep = NULL;
+ tbl->plugin_name = NULL;
tbl->instance = NULL;
tbl->results = NULL;
static void tbl_clear(tbl_t *tbl) {
sfree(tbl->file);
sfree(tbl->sep);
+ sfree(tbl->plugin_name);
sfree(tbl->instance);
for (size_t i = 0; i < tbl->results_num; ++i)
if (0 == strcasecmp(c->key, "Separator"))
tbl_config_set_s(c->key, &tbl->sep, c);
+ else if (0 == strcasecmp(c->key, "Plugin"))
+ tbl_config_set_s(c->key, &tbl->plugin_name, c);
else if (0 == strcasecmp(c->key, "Instance"))
tbl_config_set_s(c->key, &tbl->instance, c);
else if (0 == strcasecmp(c->key, "Result"))
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE(values);
- sstrncpy(vl.plugin, "table", sizeof(vl.plugin));
+ sstrncpy(vl.plugin, (tbl->plugin_name != NULL) ? tbl->plugin_name : "table",
+ sizeof(vl.plugin));
sstrncpy(vl.plugin_instance, tbl->instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, res->type, sizeof(vl.type));