[collectd] [PATCH] perl plugin: Pass on identifiers to Perl flush callbacks.

Sebastian Harl sh at tokkee.org
Thu Aug 21 10:47:18 CEST 2008


Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/collectd-perl.pod |    5 +++--
 src/perl.c            |    5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index dac80bf..7cd5d72 100644
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
@@ -263,8 +263,9 @@ string. For the layout of I<data-set> and I<value-list> see above.
 
 =item TYPE_FLUSH
 
-The only argument passed is I<timeout> which indicates that only data older
-than I<timeout> seconds is to be flushed.
+The arguments passed are I<timeout> and I<identifier>. I<timeout> indicates
+that only data older than I<timeout> seconds is to be flushed. I<identifier>
+specifies which values are to be flushed.
 
 =item TYPE_LOG
 
diff --git a/src/perl.c b/src/perl.c
index e6bb25e..8106360 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -767,8 +767,10 @@ static int pplugin_call_all (pTHX_ int type, ...)
 	else if (PLUGIN_FLUSH == type) {
 		/*
 		 * $_[0] = $timeout;
+		 * $_[1] = $identifier;
 		 */
 		XPUSHs (sv_2mortal (newSViv (va_arg (ap, int))));
+		XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0)));
 	}
 
 	PUTBACK;
@@ -1263,7 +1265,6 @@ static int perl_notify (const notification_t *notif)
 	return pplugin_call_all (aTHX_ PLUGIN_NOTIF, notif);
 } /* static int perl_notify (const notification_t *) */
 
-/* TODO: Implement flushing of single identifiers. */
 static int perl_flush (int timeout, const char *identifier)
 {
 	dTHX;
@@ -1280,7 +1281,7 @@ static int perl_flush (int timeout, const char *identifier)
 
 		aTHX = t->interp;
 	}
-	return pplugin_call_all (aTHX_ PLUGIN_FLUSH, timeout);
+	return pplugin_call_all (aTHX_ PLUGIN_FLUSH, timeout, identifier);
 } /* static int perl_flush (const int) */
 
 static int perl_shutdown (void)
-- 
1.6.0.rc2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080821/140f3b83/attachment.pgp 


More information about the collectd mailing list