1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
<!--
title: "ISC BIND monitoring with Netdata"
custom_edit_url: https://github.com/netdata/netdata/edit/master/collectors/node.d.plugin/named/README.md
sidebar_label: "ISC BIND"
-->
# ISC BIND monitoring with Netdata
Monitor one or more ISC Bind servers.
## Example Netdata charts
Depending on the number of views your bind has, you may get a large number of charts.
Here this is with just one view:
![image](https://cloud.githubusercontent.com/assets/2662304/12765473/879b8e04-ca07-11e5-817d-b0651996c42b.png)
![image](https://cloud.githubusercontent.com/assets/2662304/12766538/12b272fa-ca0d-11e5-81e1-6a9f8ff488ff.png)
## How it works
The plugin will execute (from within node.js) the equivalent of:
```sh
curl "http://localhost:8888/json/v1/server"
```
Here is a sample of the output this command produces.
```js
{
"json-stats-version":"1.0",
"boot-time":"2016-01-31T08:20:48Z",
"config-time":"2016-01-31T09:28:03Z",
"current-time":"2016-02-02T22:22:20Z",
"opcodes":{
"QUERY":247816,
"IQUERY":0,
"STATUS":0,
"RESERVED3":0,
"NOTIFY":0,
"UPDATE":3813,
"RESERVED6":0,
"RESERVED7":0,
"RESERVED8":0,
"RESERVED9":0,
"RESERVED10":0,
"RESERVED11":0,
"RESERVED12":0,
"RESERVED13":0,
"RESERVED14":0,
"RESERVED15":0
},
"qtypes":{
"A":89519,
"NS":863,
"CNAME":1,
"SOA":1,
"PTR":116779,
"MX":276,
"TXT":198,
"AAAA":39324,
"SRV":850,
"ANY":5
},
"nsstats":{
"Requestv4":251630,
"ReqEdns0":1255,
"ReqTSIG":3813,
"ReqTCP":57,
"AuthQryRej":1455,
"RecQryRej":122,
"Response":245918,
"TruncatedResp":44,
"RespEDNS0":1255,
"RespTSIG":3813,
"QrySuccess":205159,
"QryAuthAns":119495,
"QryNoauthAns":120770,
"QryNxrrset":32711,
"QrySERVFAIL":262,
"QryNXDOMAIN":2395,
"QryRecursion":40885,
"QryDuplicate":5712,
"QryFailure":1577,
"UpdateDone":2514,
"UpdateFail":1299,
"UpdateBadPrereq":1276,
"QryUDP":246194,
"QryTCP":45,
"OtherOpt":101
},
"views":{
"local":{
"resolver":{
"stats":{
"Queryv4":74577,
"Responsev4":67032,
"NXDOMAIN":601,
"SERVFAIL":5,
"FORMERR":7,
"EDNS0Fail":7,
"Truncated":3071,
"Lame":4,
"Retry":11826,
"QueryTimeout":1838,
"GlueFetchv4":6864,
"GlueFetchv4Fail":30,
"QryRTT10":112,
"QryRTT100":42900,
"QryRTT500":23275,
"QryRTT800":534,
"QryRTT1600":97,
"QryRTT1600+":20,
"BucketSize":31,
"REFUSED":13
},
"qtypes":{
"A":64931,
"NS":870,
"CNAME":185,
"PTR":5,
"MX":49,
"TXT":149,
"AAAA":7972,
"SRV":416
},
"cache":{
"A":40356,
"NS":8032,
"CNAME":14477,
"PTR":2,
"MX":21,
"TXT":32,
"AAAA":3301,
"SRV":94,
"DS":237,
"RRSIG":2301,
"NSEC":126,
"!A":52,
"!NS":4,
"!TXT":1,
"!AAAA":3797,
"!SRV":9,
"NXDOMAIN":590
},
"cachestats":{
"CacheHits":1085188,
"CacheMisses":109,
"QueryHits":464755,
"QueryMisses":55624,
"DeleteLRU":0,
"DeleteTTL":42615,
"CacheNodes":5188,
"CacheBuckets":2079,
"TreeMemTotal":2326026,
"TreeMemInUse":1508075,
"HeapMemMax":132096,
"HeapMemTotal":393216,
"HeapMemInUse":132096
},
"adb":{
"nentries":1021,
"entriescnt":3157,
"nnames":1021,
"namescnt":3022
}
}
},
"public":{
"resolver":{
"stats":{
"BucketSize":31
},
"qtypes":{
},
"cache":{
},
"cachestats":{
"CacheHits":0,
"CacheMisses":0,
"QueryHits":0,
"QueryMisses":0,
"DeleteLRU":0,
"DeleteTTL":0,
"CacheNodes":0,
"CacheBuckets":64,
"TreeMemTotal":287392,
"TreeMemInUse":29608,
"HeapMemMax":1024,
"HeapMemTotal":262144,
"HeapMemInUse":1024
},
"adb":{
"nentries":1021,
"nnames":1021
}
}
},
"_bind":{
"resolver":{
"stats":{
"BucketSize":31
},
"qtypes":{
},
"cache":{
},
"cachestats":{
"CacheHits":0,
"CacheMisses":0,
"QueryHits":0,
"QueryMisses":0,
"DeleteLRU":0,
"DeleteTTL":0,
"CacheNodes":0,
"CacheBuckets":64,
"TreeMemTotal":287392,
"TreeMemInUse":29608,
"HeapMemMax":1024,
"HeapMemTotal":262144,
"HeapMemInUse":1024
},
"adb":{
"nentries":1021,
"nnames":1021
}
}
}
}
}
```
From this output it collects:
- Global Received Requests by IP version (IPv4, IPv6)
- Global Successful Queries
- Current Recursive Clients
- Global Queries by IP Protocol (TCP, UDP)
- Global Queries Analysis
- Global Received Updates
- Global Query Failures
- Global Query Failures Analysis
- Other Global Server Statistics
- Global Incoming Requests by OpCode
- Global Incoming Requests by Query Type
- Global Socket Statistics (will only work if the url is `http://127.0.0.1:8888/json/v1`, i.e. without `/server`, but keep in mind this produces a very long output and probably will account for 0.5% CPU overhead alone, per bind server added)
- Per View Statistics (the following set will be added for each bind view):
- View, Resolver Active Queries
- View, Resolver Statistics
- View, Resolver Round Trip Timings
- View, Requests by Query Type
## Configuration
The collector (optionally) reads a configuration file named `/etc/netdata/node.d/named.conf`, with the following contents:
```js
{
"enable_autodetect": true,
"update_every": 5,
"servers": [
{
"name": "bind1",
"url": "http://127.0.0.1:8888/json/v1/server",
"update_every": 1
},
{
"name": "bind2",
"url": "http://10.1.2.3:8888/json/v1/server",
"update_every": 2
}
]
}
```
You can add any number of bind servers.
If the configuration file is missing, or the key `enable_autodetect` is `true`, the collector will also attempt to fetch `http://localhost:8888/json/v1/server` which, if successful will be added too.
### XML instead of JSON, from bind
The collector can also accept bind URLs that return XML output. This might required if you cannot have bind 9.10+ with JSON but you have an version of bind that supports XML statistics v3. Check [this](https://www.isc.org/blogs/bind-9-10-statistics-troubleshooting-and-zone-configuration/) for versions supported.
In such cases, use a URL like this:
```sh
curl "http://localhost:8888/xml/v3/server"
```
Only `xml` and `v3` has been tested.
Keep in mind though, that XML parsing is done using javascript code, which requires a triple conversion:
1. from XML to JSON using a javascript XML parser (**CPU intensive**),
2. which is then transformed to emulate the output of the JSON output of bind (**CPU intensive** - and yes the converted JSON from XML is different to the native JSON - even bind produces different names for various attributes),
3. which is then processed to generate the data for the charts (this will happen even if bind is producing JSON).
In general, expect XML parsing to be 2 to 3 times more CPU intensive than JSON.
**So, if you can use the JSON output of bind, prefer it over XML**. Keep also in mind that even bind will use more CPU when generating XML instead of JSON.
The XML interface of bind is not autodetected.
You will have to provide the config file `/etc/netdata/node.d/named.conf`, like this:
```js
{
"enable_autodetect": false,
"update_every": 1,
"servers": [
{
"name": "local",
"url": "http://localhost:8888/xml/v3/server",
"update_every": 1
}
]
}
```
Of course, you can monitor more than one bind servers. Each one can be configured with either JSON or XML output.
## Auto-detection
Auto-detection is controlled by `enable_autodetect` in the config file. The default is enabled, so that if the collector can connect to `http://localhost:8888/json/v1/server` to receive bind statistics, it will automatically enable it.
## Bind (named) configuration
To use this plugin, you have to have bind v9.10+ properly compiled to provide statistics in `JSON` format.
For more information on how to get your bind installation ready, please refer to the [bind statistics channel developer comments](http://jpmens.net/2013/03/18/json-in-bind-9-s-statistics-server/) and to [bind documentation](https://ftp.isc.org/isc/bind/9.10.3/doc/arm/Bv9ARM.ch06.html#statistics) or [bind Knowledge Base article AA-01123](https://kb.isc.org/article/AA-01123/0).
Normally, you will need something like this in your `named.conf`:
```
statistics-channels {
inet 127.0.0.1 port 8888 allow { 127.0.0.1; };
inet ::1 port 8888 allow { ::1; };
};
```
(use the IPv4 or IPv6 line depending on what you are using, you can also use both)
Verify it works by running the following command (the collector is written in node.js and will query your bind server directly, but if this command works, the collector should be able to work too):
```sh
curl "http://localhost:8888/json/v1/server"
```
[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fnode.d.plugin%2Fnamed%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>)
|