=item
+Embedded Perl interpreter (I<perl>)
+
+=item
+
Network latency (I<ping>)
=item
=head2 perl
The C<perl plugin> includes a Perl-interpreter in collectd and provides
-Perl-equvalents of the plugin-functions. This makes it possible to write
+Perl-equivalents of the plugin-functions. This makes it possible to write
plugins in Perl.
-There are two more comlex types you need to know about:
+There are two more complex types you need to know about:
=over 4
data-source. For the exact layout see B<Data-Set> above.
If the I<type> argument is any of the other types (B<TYPE_INIT>, B<TYPE_READ>,
-...) when I<data> is expected to be a funtion reference. These functions are
+...) then I<data> is expected to be a function reference. These functions are
called in the various stages of the daemon and are passed the following
arguments:
=item B<plugin_log> (I<log-level>, I<message>)
-TODO.
+Submits a I<message> of level I<log-level> to collectd's logging mechanism.
+The message is passed to all log-callbacks that are registered with collectd.
=back
static XS (Collectd_plugin_register);
static XS (Collectd_plugin_unregister);
static XS (Collectd_plugin_dispatch_values);
+static XS (Collectd_plugin_log);
/*
{ "Collectd::plugin_register", Collectd_plugin_register },
{ "Collectd::plugin_unregister", Collectd_plugin_unregister },
{ "Collectd::plugin_dispatch_values", Collectd_plugin_dispatch_values },
+ { "Collectd::plugin_log", Collectd_plugin_log },
{ "", NULL }
};
dXSARGS;
- items = 2;
if (2 != items) {
log_err ("Usage: Collectd::plugin_dispatch_values(name, values)");
XSRETURN_EMPTY;
} /* static XS (Collectd_plugin_dispatch_values) */
/*
+ * Collectd::plugin_log (level, message).
+ *
+ * level:
+ * log level (LOG_DEBUG, ... LOG_ERR)
+ *
+ * message:
+ * log message
+ */
+static XS (Collectd_plugin_log)
+{
+ dXSARGS;
+
+ if (2 != items) {
+ log_err ("Usage: Collectd::plugin_log(level, message)");
+ XSRETURN_EMPTY;
+ }
+
+ log_debug ("Collectd::plugin_log: level = %i, message = \"%s\"",
+ SvIV (ST (0)), SvPV_nolen (ST (1)));
+ plugin_log (SvIV (ST (0)), SvPV_nolen (ST (1)));
+ XSRETURN_YES;
+} /* static XS (Collectd_plugin_log) */
+
+/*
* Collectd::bootstrap ().
*/
static XS (boot_Collectd)