[collectd] DNS plugin to ignore numeric qtypes
Sebastian Harl
sh at tokkee.org
Fri May 15 12:42:13 CEST 2009
Hi Mirko,
On Thu, May 14, 2009 at 03:06:58PM +0200, Mirko Buffoni wrote:
> I've added this patch to my collectd because I have my data dir
> overpopulated by unknown query types (those not found in nameserv.h
> which are converted to their #xxxx numeric form).
>
> When enabled in configuration file, this option just prevent
> registering these qtypes to the list.
Thanks for your patch! See a few minor comments below.
> diff -uNrb collectd-4.6.2.orig/src/collectd.conf.5 collectd-4.6.2/src/collectd.conf.5
> --- collectd-4.6.2.orig/src/collectd.conf.5 2009-03-18 12:03:01.000000000 +0100
> +++ collectd-4.6.2/src/collectd.conf.5 2009-05-14 14:45:43.000000000 +0200
The manpages are built from the respective .pod files - please update
those instead.
> diff -uNrb collectd-4.6.2.orig/src/dns.c collectd-4.6.2/src/dns.c
> --- collectd-4.6.2.orig/src/dns.c 2009-03-17 14:47:15.000000000 +0100
> +++ collectd-4.6.2/src/dns.c 2009-05-14 14:45:48.000000000 +0200
> @@ -47,9 +47,11 @@
> {
> "Interface",
> "IgnoreSource",
> + "IgnoreNumericQueryTypes",
I'd rather call that option something like "IgnoreUnknownQueryTypes" or
"CollectdUnknownQueryTypes" (and defaulting to 'true') to avoid double
negations.
> + else if (strcasecmp (key, "IgnoreNumericQueryTypes") == 0)
> + {
> + if (value != NULL)
> + {
> + if (strcasecmp(value, "true") == 0 || strcmp(value,"0") != 0)
You should use the macro IS_TRUE() (from common.h). None of the other
boolean config options currently supports 0 or 1 as a boolean value -
did you have anything specific in mind when supporting that as well?
Also, please note that your if-statement evaluates to 'true' in all
cases unless the string "0" was used as value (because of the second
condition) ...
> + if (!skip) {
> pthread_mutex_lock (&qtype_mutex);
> counter_list_add (&qtype_list, dns->qtype, 1);
> pthread_mutex_unlock (&qtype_mutex);
> }
> + }
Your indentation is broken ... *scnr* ;-)
Cheers,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20090515/11ed72ea/attachment.pgp
More information about the collectd
mailing list