[collectd] Generalized ignorelist functionality

Luboš Staněk lubek at users.sourceforge.net
Tue Nov 14 11:31:29 CET 2006


Hi Florian,
I am sending the updated version of config_list.
I repaired the error freeing unallocated memory, modified regex for
dynamically allocated error message buffer and replaced '|' with '/'.

I am sorry for the bigger attachment in previous message but I thought
that the images are really nice art for others to see. Converting them
to PNM and compressing them would decrease the attachment size but
seeing them would be tricky.

Florian Forster napsal(a):
> Hi Lubos,
> 
> On Mon, Nov 13, 2006 at 05:52:35PM +0100, Lubo?? Stan??k wrote:
>> I took your remarks and draft and created the "ignore" feature, with
>> minor changes though. It handles all required tasks and adds POSIX
>> regular expressions.
>> The code is attached to the message.
> 
> thanks, I'll look into it as soon as possible :)
> 

Do not hurry. It is an enhancement and even if you accept it, it will
take a time to implement it by plugins' authors.
Please, use the updated version.


>> and for the regex version:
>> 	Sensor |.*\/temperature-.*3|
>> 	Sensor |.*\/fanspeed-.*3|
>> 	Sensor |.*\/voltage-.*3|
>>
>> The primary reason for such test was to have some information about
>> regex code efficiency.
> 
> Did you test with the above regexes? Because having two `.*' in there
> will result in a lot of backtracking. The leading `.*' is uneffective,
> so removing it will speed up the regex (unless the regex compiler is
> more intelligent than I think it is ;) and not change the results. I
> think a much faster variant of the above regexes would be:
>   Sensor \/(temperature|fanspeed|voltage)-[a-zA-Z]3
> 

It was not the goal to have the most effective regex.
I tried to make the regex as complex as possible for the comparison to
'strcmp'.


> Also, what are the pipe-signs `|' doing there? Are they the delimiters?
> That'd be bad, since the pipe is the `or' in regexes and is used a lot.
> Is a delimiter really necessary? And if so, slashes `/' would be a more
> common choice.
> 

I wanted to differentiate the string and the regex without adding new
config commands. Therefore I used '|' as a delimiter. It is possible to
use any ('/' as you offered). But maybe adding a config command like
...RE (SensorsRE) would be better for reading the collectd.conf.

I thought about making the collectd.conf checker as it became more
complicated.


>> The result is: It can be used both as a replacement and a combination
>> with ordinary string compare.
> 
> Yes, if used right regexes are _very_ fast :)
> 

They are very fast even if ineffective (with the latest glibc), as you
can see.


Best regards,
Lubos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd-ignore.tar.bz2
Type: application/x-bzip
Size: 6584 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20061114/b55fcd48/collectd-ignore.tar.bin


More information about the collectd mailing list