Batterycharge, -current and voltage of ACPI and PMU based laptop
batteries.
+ - curl
+ Parse statistics from websites using regular expressions.
+
- bind
Name server and resolver statistics from the `statistics-channel'
interface of BIND 9.5, 9,6 and later.
RX and TX of each client in openvpn-status.log (status-version 2).
<http://openvpn.net/index.php/documentation/howto.html>
+ - oracle
+ Query data from an Oracle database.
+
- perl
The perl plugin implements a Perl-interpreter into collectd. You can
write your own plugins in Perl and return arbitrary values using this
needed. Please read collectd-unixsock(5) for a description on how that's
done.
- * Filtering and rewriting values dispatched to collectd can be done by the
- following plugins:
-
- - filter_pcre
- Filter and rewrite value lists based on Perl-compatible regular
- expressions.
-
* Logging is, as everything in collectd, provided by plugins. The following
plugins keep up informed about what's going on:
Notifications are propagated to plugins written in Perl as well.
See collectd-perl(5).
+ * Value processing can be controlled using the "filter chain" infrastructure
+ and "matches" and "targets". The following plugins are available:
+
+ - match_regex
+ Match values by their identifier based on regular expressions.
+
+ - match_timediff
+ Match values with an invalid timestamp.
+
+ - match_value
+ Select values by their data sources' values.
+
+ - target_notification
+ Create and dispatch a notification.
+
+ - target_replace
+ Replace parts of an identifier using regular expressions.
+
+ - target_set
+ Set (overwrite) entire parts of an identifier.
+
* Miscellaneous plugins:
- uuid
particular.
<http://developer.apple.com/corefoundation/>
+ * libclntsh (optional)
+ Used by the `oracle' plugin.
+
* libcurl (optional)
- If you want to use the `apache', `ascent', or `nginx' plugin.
+ If you want to use the `apache', `ascent', `curl' or `nginx' plugin.
<http://curl.haxx.se/>
* libdbi (optional)
Used to capture packets by the `dns' plugin.
<http://www.tcpdump.org/>
- * libpcre (optional)
- Used by the `filter_pcre' plugin.
- <http://www.pcre.org/>
-
* libperl (optional)
Obviously used by the `perl' plugin. The library has to be compiled with
ithread support (introduced in Perl 5.6.0).
AM_CONDITIONAL(BUILD_WITH_LIBPCAP, test "x$with_libpcap" = "xyes")
# }}}
-# --with-libpcre {{{
-with_pcre_config="pcre-config"
-with_pcre_cflags=""
-with_pcre_libs=""
-AC_ARG_WITH(libpcre, [AS_HELP_STRING([--with-libpcre@<:@=PREFIX@:>@],
- [Path to libpcre.])],
- [
- if test "x$withval" = "xno"
- then
- with_libpcre="no"
- else if test "x$withval" = "xyes"
- then
- with_libpcre="yes"
- else
- if test -f "$withval" && test -x "$withval"
- then
- with_pcre_config="$withval"
- else if test -x "$withval/bin/pcre-config"
- then
- with_pcre_config="$withval/bin/pcre-config"
- fi; fi
- with_libpcre="yes"
- fi; fi
- ],
- [
- with_libpcre="yes"
- ])
-
-if test "x$with_libpcre" = "xyes"
-then
- with_pcre_cflags=`$with_pcre_config --cflags 2>/dev/null`
- pcre_config_status=$?
-
- if test $pcre_config_status -ne 0
- then
- with_libpcre="no ($with_pcre_config failed)"
- else
- SAVE_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $with_pcre_cflags"
-
- AC_CHECK_HEADERS(pcre.h, [], [with_libpcre="no (pcre.h not found)"], [])
-
- CPPFLAGS="$SAVE_CPPFLAGS"
- fi
-fi
-
-if test "x$with_libpcre" = "xyes"
-then
- with_pcre_libs=`$with_pcre_config --libs 2>/dev/null`
- pcre_config_status=$?
-
- if test $pcre_config_status -ne 0
- then
- with_libpcre="no ($with_pcre_config failed)"
- else
- AC_CHECK_LIB(pcre, pcre_compile,
- [with_libpcre="yes"],
- [with_libpcre="no (symbol 'pcre_compile' not found)"],
- [$with_pcre_libs])
- fi
-fi
-
-if test "x$with_libpcre" = "xyes"
-then
- BUILD_WITH_LIBPCRE_CFLAGS="$with_pcre_cflags"
- BUILD_WITH_LIBPCRE_LIBS="$with_pcre_libs"
- AC_SUBST(BUILD_WITH_LIBPCRE_CFLAGS)
- AC_SUBST(BUILD_WITH_LIBPCRE_LIBS)
-fi
-AM_CONDITIONAL(BUILD_WITH_LIBPCRE, test "x$with_libpcre" = "xyes")
-# }}}
-
# --with-libperl {{{
perl_interpreter="perl"
AC_ARG_WITH(libperl, [AS_HELP_STRING([--with-libperl@<:@=PREFIX@:>@], [Path to libperl.])],
libopenipmi . . . . . $with_libopenipmipthread
liboping . . . . . . $with_liboping
libpcap . . . . . . . $with_libpcap
- libpcre . . . . . . . $with_libpcre
libperl . . . . . . . $with_libperl
libpq . . . . . . . . $with_libpq
libpthread . . . . . $with_libpthread
if BUILD_PLUGIN_MATCH_REGEX
pkglib_LTLIBRARIES += match_regex.la
match_regex_la_SOURCES = match_regex.c
-match_regex_la_CPPFLAGS = $(BUILD_WITH_LIBPCRE_CFLAGS)
-match_regex_la_LDFLAGS = -module -avoid-version \
- $(BUILD_WITH_LIBPCRE_LIBS)
+match_regex_la_LDFLAGS = -module -avoid-version
collectd_LDADD += "-dlopen" match_regex.la
collectd_DEPENDENCIES += match_regex.la
endif
=back
-=head2 Plugin C<filter_pcre>
-
-This plugin allows you to filter and rewrite value lists based on
-Perl-compatible regular expressions whose syntax and semantics are as close as
-possible to those of the Perl 5 language. See L<pcre(3)> for details.
-
- <Plugin filter_pcre>
- <RegEx>
- Host "^mail\d+$"
- Plugin "^tcpconns$"
- TypeInstance "^SYN_"
-
- Action NoWrite
- </RegEx>
-
- <RegEx>
- Plugin "^sensors$"
- PluginInstance "^Some Weird Sensor Chip Name Prefix"
-
- SubstitutePluginInstance "foo"
- </RegEx>
- </Plugin>
-
-The configuration consists of one or more C<RegEx> blocks, each of which
-specifies a regular expression identifying a set of value lists and how to
-handle successful matches. A value list keeps the values of a single data-set
-and is identified by the tuple (host, plugin, plugin instance, type, type
-instance). The plugin and type instances are optional components. If they are
-missing they are treated as empty strings. Within those blocks, the following
-options are recognized:
-
-=over 4
-
-=item B<Host> I<regex>
-
-=item B<Plugin> I<regex>
-
-=item B<PluginInstance> I<regex>
-
-=item B<Type> I<regex>
-
-=item B<TypeInstance> I<regex>
-
-Specifies the regular expression for each component of the identifier. If any
-of these options is missing it is interpreted as a pattern which matches any
-string. All five components of a value list have to match the appropriate
-regular expression to trigger the specified action.
-
-=item B<Action> I<NoWrite>|I<NoThresholdCheck>|I<Ignore>
-
-Specify how to handle successful matches:
-
-=over 4
-
-=item B<NoWrite>
-
-Do not send the value list to any output (a.k.a. write) plugins.
-
-=item B<NoThresholdCheck>
-
-Skip threshold checking for this value list.
-
-=item B<Ignore>
-
-Completely ignore this value list.
-
-=back
-
-Two or more actions may be combined by specifying multiple B<Action> options.
-
-=item B<SubstituteHost> I<replacement>
-
-=item B<SubstitutePlugin> I<replacement>
-
-=item B<SubstitutePluginInstance> I<replacement>
-
-=item B<SubstituteType> I<replacement>
-
-=item B<SubstituteTypeInstance> I<replacement>
-
-Upon a successful match, the matching substring will be replaced by the
-specified I<replacement> text. These options require that an appropriate regex
-has been specified before, e.E<nbsp>g. B<SubstituteHost> requires that the
-B<Host> option has been specified before.
-
-B<Note>: It is not recommended to modify the type unless you really know what
-you are doing. The type is used to identify the data-set definition of the
-dispatched values.
-
-=back
-
=head2 Plugin C<hddtemp>
To get values from B<hddtemp> collectd connects to B<localhost> (127.0.0.1),
L<iptables(8)>,
L<kstat(3KSTAT)>,
L<mbmon(1)>,
-L<pcre(3)>,
L<psql(1)>,
L<regex(7)>,
L<rrdtool(1)>,
return (ret);
} /* oconfig_item_t *oconfig_parse_file */
+oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig)
+{
+ oconfig_item_t *ci_copy;
+
+ ci_copy = (oconfig_item_t *) malloc (sizeof (*ci_copy));
+ if (ci_copy == NULL)
+ {
+ fprintf (stderr, "malloc failed.\n");
+ return (NULL);
+ }
+ memset (ci_copy, 0, sizeof (*ci_copy));
+ ci_copy->values = NULL;
+ ci_copy->parent = NULL;
+ ci_copy->children = NULL;
+
+ ci_copy->key = strdup (ci_orig->key);
+ if (ci_copy->key == NULL)
+ {
+ fprintf (stderr, "strdup failed.\n");
+ free (ci_copy);
+ return (NULL);
+ }
+
+ if (ci_orig->values_num > 0) /* {{{ */
+ {
+ int i;
+
+ ci_copy->values = (oconfig_value_t *) calloc (ci_orig->values_num,
+ sizeof (*ci_copy->values));
+ if (ci_copy->values == NULL)
+ {
+ fprintf (stderr, "calloc failed.\n");
+ free (ci_copy->key);
+ free (ci_copy);
+ return (NULL);
+ }
+ ci_copy->values_num = ci_orig->values_num;
+
+ for (i = 0; i < ci_copy->values_num; i++)
+ {
+ ci_copy->values[i].type = ci_orig->values[i].type;
+ if (ci_copy->values[i].type == OCONFIG_TYPE_STRING)
+ {
+ ci_copy->values[i].value.string
+ = strdup (ci_orig->values[i].value.string);
+ if (ci_copy->values[i].value.string == NULL)
+ {
+ fprintf (stderr, "strdup failed.\n");
+ oconfig_free (ci_copy);
+ return (NULL);
+ }
+ }
+ else /* ci_copy->values[i].type != OCONFIG_TYPE_STRING) */
+ {
+ ci_copy->values[i].value = ci_orig->values[i].value;
+ }
+ }
+ } /* }}} if (ci_orig->values_num > 0) */
+
+ if (ci_orig->children_num > 0) /* {{{ */
+ {
+ int i;
+
+ ci_copy->children = (oconfig_item_t *) calloc (ci_orig->children_num,
+ sizeof (*ci_copy->children));
+ if (ci_copy->children == NULL)
+ {
+ fprintf (stderr, "calloc failed.\n");
+ oconfig_free (ci_copy);
+ return (NULL);
+ }
+ ci_copy->children_num = ci_orig->children_num;
+
+ for (i = 0; i < ci_copy->children_num; i++)
+ {
+ oconfig_item_t *child;
+
+ child = oconfig_clone (ci_orig->children + i);
+ if (child == NULL)
+ {
+ oconfig_free (ci_copy);
+ return (NULL);
+ }
+ child->parent = ci_copy;
+ ci_copy->children[i] = *child;
+ free (child);
+ } /* for (i = 0; i < ci_copy->children_num; i++) */
+ } /* }}} if (ci_orig->children_num > 0) */
+
+ return (ci_copy);
+} /* oconfig_item_t *oconfig_clone */
+
void oconfig_free (oconfig_item_t *ci)
{
int i;
}
/*
- * vim:shiftwidth=2:tabstop=8:softtabstop=2
+ * vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker
*/
/**
* oconfig - src/oconfig.h
- * Copyright (C) 2006,2007 Florian octo Forster <octo at verplant.org>
+ * Copyright (C) 2006-2009 Florian octo Forster <octo at verplant.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
oconfig_item_t *oconfig_parse_fh (FILE *fh);
oconfig_item_t *oconfig_parse_file (const char *file);
+oconfig_item_t *oconfig_clone (const oconfig_item_t *ci);
+
void oconfig_free (oconfig_item_t *ci);
/*