summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b2ea1d9)
raw | patch | inline | side by side (parent: b2ea1d9)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Sun, 24 Apr 2016 14:54:29 +0000 (20:54 +0600) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 10 Jul 2017 09:18:43 +0000 (16:18 +0700) |
src/collectd.conf.pod | patch | blob | history | |
src/memcachec.c | patch | blob | history |
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index f99fe77f2d9328fdec702f7d365a86e5344adfa7..91ff74162996a55b732b77154cdb038ed94878d6 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
<Page "plugin_instance">
Server "localhost"
Key "page_key"
+ PluginName "plugin_name"
<Match>
Regex "(\\d+) bytes sent"
DSType CounterAdd
When connected to the memcached server, asks for the page I<Key>.
+=item B<PluginName> I<PluginName>
+
+Use I<PluginName> as the plugin name when submitting values.
+Defaults to 'memcachec'.
+
=item E<lt>B<Match>E<gt>
Match blocks define which strings to look for and how matches substrings are
diff --git a/src/memcachec.c b/src/memcachec.c
index c2147fd51b1f98025d26ec64bd34195495834828..965aa6539bbfc52e404753225d1e66c3aa1894ed 100644 (file)
--- a/src/memcachec.c
+++ b/src/memcachec.c
typedef struct web_page_s web_page_t;
struct web_page_s /* {{{ */
{
+ char *plugin_name;
char *instance;
char *server;
memcached_free(wp->memc);
wp->memc = NULL;
+ sfree(wp->plugin_name);
sfree(wp->instance);
sfree(wp->server);
sfree(wp->key);
status = cmc_config_add_string("Server", &page->server, child);
else if (strcasecmp("Key", child->key) == 0)
status = cmc_config_add_string("Key", &page->key, child);
+ else if (strcasecmp("PluginName", child->key) == 0)
+ status = cmc_config_add_string("PluginName", &page->plugin_name, child);
else if (strcasecmp("Match", child->key) == 0)
/* Be liberal with failing matches => don't set `status'. */
cmc_config_add_match(page, child);
vl.values = &value;
vl.values_len = 1;
- sstrncpy(vl.plugin, "memcachec", sizeof(vl.plugin));
+ sstrncpy(vl.plugin, (wp->plugin_name != NULL) ? wp->plugin_name : "memcachec",
+ sizeof (vl.plugin));
sstrncpy(vl.plugin_instance, wp->instance, sizeof(vl.plugin_instance));
sstrncpy(vl.type, wm->type, sizeof(vl.type));
sstrncpy(vl.type_instance, wm->instance, sizeof(vl.type_instance));