summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cd35a6a)
raw | patch | inline | side by side (parent: cd35a6a)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 17:55:43 +0000 (18:55 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 14 Nov 2012 17:55:43 +0000 (18:55 +0100) |
bindings/perl/lib/Collectd.pm | patch | blob | history | |
src/collectd-perl.pod | patch | blob | history | |
src/perl.c | patch | blob | history |
index ca3b5d2349805a505ae22df4faad8c7b9feda529..251412cff173538962b04e5676dc0d750f489d00 100644 (file)
plugin_register
plugin_unregister
plugin_dispatch_values
+ plugin_get_interval
plugin_write
plugin_flush
plugin_flush_one
diff --git a/src/collectd-perl.pod b/src/collectd-perl.pod
index d5401dd4c7aac55bf1f08d8c5cf5ecbd0c9ff733..a19274e4278030c0e90fad3d4ed8bbdbcab78c9f 100644 (file)
--- a/src/collectd-perl.pod
+++ b/src/collectd-perl.pod
Wrappers around B<plugin_log>, using B<LOG_ERR>, B<LOG_WARNING>,
B<LOG_NOTICE>, B<LOG_INFO> and B<LOG_DEBUG> respectively as I<log-level>.
+=item B<plugin_get_interval> ()
+
+Returns the interval of the current plugin as a floating point number in
+seconds. This value depends on the interval configured within the
+C<LoadPlugin perl> block or the global interval (see L<collectd.conf(5)> for
+details).
+
=back
The following function provides the filter chain C-interface to Perl-modules.
diff --git a/src/perl.c b/src/perl.c
index f8a482275d89bde294344222b060294cdaa8b3e6..e5dc6c7563437c18134aab5fc4dd1c557a51ae36 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
static XS (Collectd_plugin_register_ds);
static XS (Collectd_plugin_unregister_ds);
static XS (Collectd_plugin_dispatch_values);
+static XS (Collectd_plugin_get_interval);
static XS (Collectd__plugin_write);
static XS (Collectd__plugin_flush);
static XS (Collectd_plugin_dispatch_notification);
{ "Collectd::plugin_register_data_set", Collectd_plugin_register_ds },
{ "Collectd::plugin_unregister_data_set", Collectd_plugin_unregister_ds },
{ "Collectd::plugin_dispatch_values", Collectd_plugin_dispatch_values },
+ { "Collectd::plugin_get_interval", Collectd_plugin_get_interval },
{ "Collectd::_plugin_write", Collectd__plugin_write },
{ "Collectd::_plugin_flush", Collectd__plugin_flush },
{ "Collectd::plugin_dispatch_notification",
XSRETURN_EMPTY;
} /* static XS (Collectd_plugin_dispatch_values) */
+/*
+ * Collectd::plugin_get_interval ().
+ */
+static XS (Collectd_plugin_get_interval)
+{
+ dXSARGS;
+
+ /* make sure we don't get any unused variable warnings for 'items';
+ * don't abort, though */
+ if (items)
+ log_err ("Usage: Collectd::plugin_get_interval()");
+
+ XSRETURN_NV ((NV) CDTIME_T_TO_DOUBLE (plugin_get_interval ()));
+} /* static XS (Collectd_plugin_get_interval) */
+
/* Collectd::plugin_write (plugin, ds, vl).
*
* plugin: