summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 108b6a4)
raw | patch | inline | side by side (parent: 108b6a4)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Sat, 14 May 2016 17:14:30 +0000 (23:14 +0600) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Fri, 16 Sep 2016 04:46:26 +0000 (10:46 +0600) |
src/collectd-perl.pod | patch | blob | history | |
src/perl.c | patch | blob | history |
diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index 0102e9216d39e1bd685fe49de5b92f707da50d16..f1913b8e908742dddc3a805a951aef8a05d39f6d 100644 (file)
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
=back
-=head1 KNOWN BUGS
-
-=over 4
-
-=item *
-
-Currently, it is not possible to flush a single Perl plugin only. You can
-either flush all Perl plugins or none at all and you have to use C<perl> as
-plugin name when doing so.
-
-=back
-
=head1 SEE ALSO
L<collectd(1)>,
diff --git a/src/perl.c b/src/perl.c
index 9f7b869f0c78722c31d31b6f85b6d92dcd5e2c6b..04745c85ea8ef54c775802d1c4d2f0a4cf61dd0c 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
*
* Authors:
* Sebastian Harl <sh at tokkee.org>
+ * Pavel Rochnyak <pavel2000 ngs.ru>
**/
/*
@@ -1628,7 +1629,7 @@ static void _plugin_register_generic_userdata (pTHX, int type, const char *desc)
{
int ret = 0;
user_data_t userdata;
- char cb_name[DATA_MAX_NAME_LEN];
+ char *pluginname;
dXSARGS;
@@ -1649,11 +1650,13 @@ static void _plugin_register_generic_userdata (pTHX, int type, const char *desc)
XSRETURN_EMPTY;
}
+ /* Use pluginname as-is to allow flush a single perl plugin */
+ pluginname = SvPV_nolen (ST (0));
+
log_debug ("Collectd::plugin_register_%s: "
"plugin = \"%s\", sub = \"%s\"",
- desc, SvPV_nolen (ST (0)), SvPV_nolen (ST (1)));
+ desc, pluginname, SvPV_nolen (ST (1)));
- ssnprintf (cb_name, sizeof (cb_name), "perl/%s", SvPV_nolen (ST (0)));
memset(&userdata, 0, sizeof(userdata));
userdata.data = strdup(SvPV_nolen (ST (1)));
userdata.free_func = free;
@@ -1661,22 +1664,22 @@ static void _plugin_register_generic_userdata (pTHX, int type, const char *desc)
if (PLUGIN_READ == type) {
ret = plugin_register_complex_read(
"perl", /* group */
- cb_name,
+ pluginname,
perl_read,
plugin_get_interval(), /* Default interval */
&userdata);
}
else if (PLUGIN_WRITE == type) {
- ret = plugin_register_write(cb_name, perl_write, &userdata);
+ ret = plugin_register_write(pluginname, perl_write, &userdata);
}
else if (PLUGIN_LOG == type) {
- ret = plugin_register_log(cb_name, perl_log, &userdata);
+ ret = plugin_register_log(pluginname, perl_log, &userdata);
}
else if (PLUGIN_NOTIF == type) {
- ret = plugin_register_notification(cb_name, perl_notify, &userdata);
+ ret = plugin_register_notification(pluginname, perl_notify, &userdata);
}
else if (PLUGIN_FLUSH == type) {
- ret = plugin_register_flush(cb_name, perl_flush, &userdata);
+ ret = plugin_register_flush(pluginname, perl_flush, &userdata);
}
else {
ret = -1;