I recently showed a customer who makes heavy use of the BIND name server, that he could access BIND’s statistics via the statistics-server. We weren’t really amused when we noticed that producing the XML on a server with a lot of zones took several minutes and delivered a whopping fifty megs of data.

It occurred to me that this could be streamlined (produce less data and consume less time) if BIND would output its information as JSON. I proposed the idea and a patch and received very positive feedback from BIND users (a lot of +1s in my inbox) and also from ISC.

Evan Hunt talked to me, re-implemented my patch correctly, and added some very good ideas. And I have some extremely good news: BIND’s statistics server will provide JSON (in addition to optional XML) starting with BIND 9.10!

What follows is a preview (careful! This could change until the release) of what the JSON output looks like.

The plan is to have different URIs which will provide just the information I’m interested in. This is different to the XML statistics, which are output as one huge data set. The URIs currently implemented (in the version I’ve seen) are

/json
/json/server
/json/zones
/json/tasks
/json/net
/json/mem

So, for example, the /json URI will print everything:

{
  "json-stats-version":"1.0",
  "boot-time":"2013-03-18T08:53:32Z",
  "current-time":"2013-03-18T09:09:58Z",
  "opcodes":{
    "QUERY":1
  },
  "qtypes":{
    "A":1
  },
  "nsstats":{
    "Requestv4":1,
    "Response":1,
    "QrySuccess":1,
    "QryNoauthAns":1,
    "QryRecursion":1
  },
  "zonestats":{
    "SOAOutv4":30,
    "AXFRReqv4":2,
    "XfrFail":2
  },
  "views":{
    "_default":{
      "zones":[
        {
          "name":"b.aa",
          "class":"IN",
[...]

The /json/zones URI will produce the list of views and zones only:

{
  "json-stats-version":"1.0",
  "boot-time":"2013-03-18T08:53:32Z",
  "current-time":"2013-03-18T09:14:23Z",
  "views":{
    "_default":{
      "zones":[
        {
          "name":"b.aa",
          "class":"IN",
          "serial":1
        },
[...]

etc. I think this is really a useful addition to the statistics-server, because parsing JSON is much faster than parsing XML.

As I mentioned, this may still be a moving target, but I thought you might want to know what’s on the horizon for BIND9’s statistics server.

BIND and JSON :: 18 Mar 2013 :: e-mail