[collectd] Generalized ignorelist functionality
Florian Forster
octo at verplant.org
Mon Nov 20 19:31:06 CET 2006
Hi Lubos,
On Sat, Nov 18, 2006 at 02:48:20PM +0100, Lubo?? Stan??k wrote:
> > - Is the `init' function necessary? If there was polymorphism in C I'd
> > welcome having a default-argument for the `create' function, but think
> > think having both, `init' and `create' with basically the same
> > functionality, is confusing.
>
> Because you proposed the "ignorelist_t *ignorelist_create (int
> inverse);". The state of the "ignore" is commonly not known to the end
> of the options. Therefore I have created the function not requiring a
> parameter. It can be omitted.
I've removed the function. Plugins need to set a reasonable default
themselves and can change their mind whenever they chose to..
> > - Why did you make the regex-stuff optional? The regex-things are in
> > POSIX and should therefore exist everywhere. (How well that works can
> > be seen in `utils_mount.c' *sigh*) Anyway, if someone only writes
> > `Match foobar' the regex-automaton will essentially do the same as
> > `strcmp'..
>
> I do not know much about portability of the POSIX stuff to some
> marginal systems like old HP-UX or Solaris. Therefore the regex is
> selectable to be able to compile collectd without it. If you think it
> is really portable, you can remove the selection.
I've kept the `#if HAVE_REGEX_H' stuff, but removed the argument from
the configure script. The configure script now checks for `regex.h' in
any case.
> > Also, we would not need the delimiters then, which I don't like that
> > much.
>
> Do you have another idea how to differentiate strings and regexes?
No. Yes. Well, just _don't_ use string-matching and always use regexes.
If you provide a simple string like `foobar' the regex stuff does the
same without much overhead, but you have the power right there if you
need it. Thoughts and other opinions are welcome :)
Apart from these additional notices: I've merged your code into the
master branch and to have used the interface at least once myself I
implemented some selection stuff for the `df' plugin. You can now
select/ignore partitions depending on (fs-)type, mountpoint and device.
If you want to use the regex-stuff for matching mountpoints, you will
need to use stuff like this:
Device /^/(media|proc|sys)/
Since the code right now simple removes a leading and a trailing slash,
you don't need to escape internal slashes. That's confusing. Also, the
way to use the string-matching code is like this:
Device /media/cdrom
This is _not_ parsed as a regular expression, because it's _not_
followed by a slash. That's confusing, too.
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/20061120/d4787b20/attachment.pgp
More information about the collectd
mailing list