[collectd] patch for email stats from postfix and amavisd-new, dns stats from powerdns

Florian Forster octo at verplant.org
Wed Nov 21 13:02:42 CET 2007


Hi Luke,

thank you very much for your patch :)

sorry for my late reply, I'm afraid my spare time is very limited at the
moment :( Fortunately Sebastian has already written a mail and I agree
with everything he said..

On Wed, Nov 21, 2007 at 12:48:39AM +0100, Sebastian Harl wrote:
> As noted above: this should be split into two plugins.

I agree totally. It'd be best if you could first create a patch that
puts the tail-like stuff into a module in collectd and send it here for
discussion. This might save some work on the plugins later on..

I think an object oriented interface would be the best here:
- create:  Gets the filename and returnes the object
- open:    Opens the file, seeks to the last position and returnes a
           FILE*
- close:   Saves the current position and closes the filehandle
- destroy: Frees the object
Just an idea though, do as you see fit ;)

> > +static int config_keys_len = 3;
> 
> You can use the STATIC_ARRAY_SIZE() macro (defined in collectd.h) to
> get the size of static arrays. This might prevent some errors in the
> future.

This can still be found in many old plugins. Using `STATIC_ARRAY_SIZE'
here is prefered now, though.

> > +	switch( *--ptr2 ) {

As a general rule: Please don't rely on operator precedence.

> > --- collectd-pristine/src/types.db	2007-11-17 04:44:33.421223427 +0000
> > +++ collectd/src/types.db	2007-11-18 02:34:08.681952461 +0000
> 
> > +pf_received_loc		value:COUNTER:0:U
> > +pf_delivered_loc	value:COUNTER:0:U
> > +pf_received_net		value:COUNTER:0:U
> [...]
> > +av_passed_clean		value:COUNTER:0:U
> > +av_passed_spammy	value:COUNTER:0:U
> > +av_passed_spam		value:COUNTER:0:U
> [...]

The differentiation between `postfix' and `amavis' should be made by
setting the `plugin' field accordingly. I assume that you would have
done that anyway ;)

The ``type'' determines how the graph should be drawn and there should
not be too many.. You have basically two types:
- Number of emails
- Email traffic 

For the first you could use the very generic ``counter'' type, but in
order to create more adopted graphs I'd probably follow Sebastian's
suggestion and create a ``email_counter'' (or similar) type.
For the traffic I'd copy the `if_octets' to `email_octets' (or similar).

The differentiation between the different `email_counter' graphs is done
using the ``type instance''. If there are several logical parts, such as
``received'' and ``local'', please separate them with a dash, not an
underscore. For example:
- received-local
- received-remote
- delivered-local
- passed-clean
- passed-spam
- ...
The underscore should be used for a part that has several words, such
as:
- blocked-bad_header

Since later a graph should be defined that combines these numbers I
wouldn't collect the total number of emails scanned/handled. It doesn't
hold any new information and complicates graphing..

> Florian, maybe we should document how this tuple is supposed to be
> used somewhere - especially, as the interface now is available to the
> user through the perl, exec, etc. plugins.

I'll write up a more general guide on how data should be structured and
named.

Best 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/20071121/f5d7d758/attachment.pgp 


More information about the collectd mailing list