bind plugin: Fix various bugs.
authorBruno Prémont <bonbons@linux-vserver.org>
Thu, 19 Feb 2009 08:42:05 +0000 (09:42 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Thu, 19 Feb 2009 08:42:05 +0000 (09:42 +0100)
On Mon, 16 February 2009 Florian Forster wrote:
> The new plugins are:
>
>   * BIND:      Name-server and zone statistics

A few bugs are hidden there, attached is a patch that fixes most
of those I've discovered untils now.

- Url parameter never considered
- missing type definition for dns_reject
- MemoryStats is linked to the wrong variable
  (TODO: memory stats seem not to work, probably dispatch_counter()
   for gauge value ...)
- SOAOutv6 should be translated to SOA-IPv6 instead of SOA-IPv4
  in order to be saved correctly and not cause timestamp collisions

Bruno

src/bind.c
src/types.db

index 8e785d9..bb3496c 100644 (file)
@@ -178,7 +178,7 @@ static const translation_info_t zonestats_translation_table[] = /* {{{ */
   { "NotifyRej",       "dns_notify",   "rejected"    },
   /* SOA/AXFS/IXFS requests */
   { "SOAOutv4",        "dns_opcode",   "SOA-IPv4"    },
-  { "SOAOutv6",        "dns_opcode",   "SOA-IPv4"    },
+  { "SOAOutv6",        "dns_opcode",   "SOA-IPv6"    },
   { "AXFRReqv4",       "dns_opcode",   "AXFR-IPv4"   },
   { "AXFRReqv6",       "dns_opcode",   "AXFR-IPv6"   },
   { "IXFRReqv4",       "dns_opcode",   "IXFR-IPv4"   },
@@ -1315,7 +1315,16 @@ static int bind_config (oconfig_item_t *ci) /* {{{ */
   {
     oconfig_item_t *child = ci->children + i;
 
-    if (strcasecmp ("OpCodes", child->key) == 0)
+    if (strcasecmp ("Url", child->key) == 0) {
+      if ((child->values_num != 1) || (child->values[0].type != OCONFIG_TYPE_STRING))
+      {
+        WARNING ("bind plugin: The `Url' option needs "
+                 "exactly one string argument.");
+        return (-1);
+      }
+
+      url = strdup (child->values[0].value.string);
+    } else if (strcasecmp ("OpCodes", child->key) == 0)
       bind_config_set_bool ("OpCodes", &global_opcodes, child);
     else if (strcasecmp ("QTypes", child->key) == 0)
       bind_config_set_bool ("QTypes", &global_qtypes, child);
@@ -1326,7 +1335,7 @@ static int bind_config (oconfig_item_t *ci) /* {{{ */
     else if (strcasecmp ("ResolverStats", child->key) == 0)
       bind_config_set_bool ("ResolverStats", &global_resolver_stats, child);
     else if (strcasecmp ("MemoryStats", child->key) == 0)
-      bind_config_set_bool ("MemoryStats", &global_resolver_stats, child);
+      bind_config_set_bool ("MemoryStats", &global_memory_stats, child);
     else if (strcasecmp ("View", child->key) == 0)
       bind_config_add_view (child);
     else
index 6d01532..82b5b4f 100644 (file)
@@ -33,6 +33,7 @@ dns_notify            value:COUNTER:0:65535
 dns_transfer           value:COUNTER:0:65535
 dns_query              value:COUNTER:0:65535
 dns_response           value:COUNTER:0:65535
+dns_reject             value:COUNTER:0:65535
 email_check            value:GAUGE:0:U
 email_count            value:GAUGE:0:U
 email_size             value:GAUGE:0:U