[collectd] Unify the filter_pcre and filter_ignore plugins

Florian Forster octo at verplant.org
Tue Oct 28 23:12:50 CET 2008


Hi,

for those who haven't noticed yet: Sebastian and I have introduced a new
type of plugin, called ``filter plugin''. It is called before the
`write' plugins and can be used to alter the values (or their name) or
to ignore some values altogether.

> filter_pcre: Added a plugin to filter value lists based on PCRE.
> 
> The user may specify a set of Perl-compatible regular expressions to match any
> component of the (host, plugin, plugin instance, type, type instance) tuple.
> Any of the filter flags may be used to handle a successful match.
> 
> Sample plugin configuration:
> 
>   <Plugin filter_pcre>
>     <RegEx>
>       Host "^mail\d+$"
>       Plugin "^tcpconns$"
>       TypeInstance "^SYN_"
> 
>       Action NoWrite
>   </Plugin>

I'm thinking about unifying the this plugin and the new `filter_ignore'
plugin are configured. The `filter_ignore' provides only three options:
 - IgnoreHost
 - IgnorePlugin
 - IgnoreType

The `filter_ignore' doesn't use any (`RegEx'-)blocks. Only one `ignore'
rule has to match for a value to be ignored. Thus, the only way to
ignore a specific `type, type-instance' pair (likewise for `plugin') is
to specify them at once. For example:
  IgnoreType "/^if_errors-[^p][^p][^p]/"
This rule will ignore all errors of non-`ppp' interfaces, because
interface errors are often only interesting on WAN interfaces. Traffic
(i. e. `if_octets') as still collected for all interfaces. The extra
slashes mark a regular expression, since the usual `ignorelist'
functionality is used.
  
I think adding these blocks to `filter_ignore' is a must, if only to
make the selection possibilities functional complete. (scnr ;)

I'm at a loss if the `TypeInstance' and `PluginInstance' options should
be merged into the `Type' and `Plugin' options in the `filter_pcre'
plugin. Thoughts, anyone?

Also, would it be possible to fall back to ``normal'', i. e. enhanced
POSIX regular expressions if `libpcre' isn't available? Then we could
completely ditch the `filter_ignore' plugin, imho. Sebastian, what do
you think?

Regards,
-octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- 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/20081028/be399dc7/attachment.pgp 


More information about the collectd mailing list