|
3 | 3 | // collect statistics from bind (named) v9.10+ |
4 | 4 | // |
5 | 5 | // bind statistics documentation at: |
| 6 | +// http://jpmens.net/2013/03/18/json-in-bind-9-s-statistics-server/ |
6 | 7 | // https://ftp.isc.org/isc/bind/9.10.3/doc/arm/Bv9ARM.ch06.html#statistics |
7 | 8 |
|
8 | 9 | // example configuration in /etc/netdata/named.conf |
@@ -305,6 +306,9 @@ var named = { |
305 | 306 | if(typeof r.qtypes !== 'undefined') |
306 | 307 | service.module.chartFromMembers(service, r.qtypes, 'in_qtypes', 'Bind, Global Incoming Requests by Query Type', 'requests/s', 'named', 'named', netdata.chartTypes.stacked, 2000, netdata.chartAlgorithms.incremental, 1, 1); |
307 | 308 |
|
| 309 | + if(typeof r.sockstats !== 'undefined') |
| 310 | + service.module.chartFromMembers(service, r.sockstats, 'in_sockstats', 'Bind, Global Socket Statistics', 'operations/s', 'named', 'named', netdata.chartTypes.line, 2500, netdata.chartAlgorithms.incremental, 1, 1); |
| 311 | + |
308 | 312 | if(typeof r.views !== 'undefined') { |
309 | 313 | for( var x in r.views ) { |
310 | 314 | var resolver = r.views[x].resolver; |
@@ -399,10 +403,71 @@ var named = { |
399 | 403 | service.end(); |
400 | 404 | } |
401 | 405 | } |
402 | | - |
403 | | - if(typeof resolver.qtypes !== 'undefined') |
404 | | - service.module.chartFromMembers(service, resolver.qtypes, 'view_resolver_qtypes_' + x, 'Bind, ' + x + ' View, Requests by Query Type', 'requests/s', 'named', 'named', netdata.chartTypes.stacked, 6000, netdata.chartAlgorithms.incremental, 1, 1); |
405 | 406 | } |
| 407 | + |
| 408 | + if(typeof resolver.qtypes !== 'undefined') |
| 409 | + service.module.chartFromMembers(service, resolver.qtypes, 'view_resolver_qtypes_' + x, 'Bind, ' + x + ' View, Requests by Query Type', 'requests/s', 'named', 'named', netdata.chartTypes.stacked, 6000, netdata.chartAlgorithms.incremental, 1, 1); |
| 410 | + |
| 411 | + //if(typeof resolver.cache !== 'undefined') |
| 412 | + // service.module.chartFromMembers(service, resolver.cache, 'view_resolver_cache_' + x, 'Bind, ' + x + ' View, Cache Entries', 'entries', 'named', 'named', netdata.chartTypes.stacked, 7000, netdata.chartAlgorithms.absolute, 1, 1); |
| 413 | + |
| 414 | + if(typeof resolver.cachestats['CacheHits'] !== 'undefined' && resolver.cachestats['CacheHits'] > 0) { |
| 415 | + var id = 'named_' + service.name + '.view_resolver_cachehits_' + x; |
| 416 | + var chart = named.charts[id]; |
| 417 | + |
| 418 | + if(typeof chart === 'undefined') { |
| 419 | + chart = { |
| 420 | + id: id, // the unique id of the chart |
| 421 | + name: '', // the unique name of the chart |
| 422 | + title: service.name + ' Bind, ' + x + ' View, Resolver Cache Hits', // the title of the chart |
| 423 | + units: 'operations/s', // the units of the chart dimensions |
| 424 | + family: 'named', // the family of the chart |
| 425 | + category: 'named', // the category of the chart |
| 426 | + type: netdata.chartTypes.area, // the type of the chart |
| 427 | + priority: 8000, // the priority relative to others in the same family and category |
| 428 | + update_every: Math.round(service.update_every / 1000), // the expected update frequency of the chart |
| 429 | + dimensions: { |
| 430 | + 'CacheHits': { |
| 431 | + id: 'CacheHits', // the unique id of the dimension |
| 432 | + name: 'hits', // the name of the dimension |
| 433 | + algorithm: netdata.chartAlgorithms.incremental,// the id of the netdata algorithm |
| 434 | + multiplier: 1, // the multiplier |
| 435 | + divisor: 1, // the divisor |
| 436 | + hidden: false // is hidden (boolean) |
| 437 | + }, |
| 438 | + 'CacheMisses': { |
| 439 | + id: 'CacheMisses', // the unique id of the dimension |
| 440 | + name: 'misses', // the name of the dimension |
| 441 | + algorithm: netdata.chartAlgorithms.incremental,// the id of the netdata algorithm |
| 442 | + multiplier: -1, // the multiplier |
| 443 | + divisor: 1, // the divisor |
| 444 | + hidden: false // is hidden (boolean) |
| 445 | + } |
| 446 | + } |
| 447 | + }; |
| 448 | + |
| 449 | + chart = service.chart(id, chart); |
| 450 | + named.charts[id] = chart; |
| 451 | + } |
| 452 | + |
| 453 | + service.begin(chart); |
| 454 | + service.set('CacheHits', resolver.cachestats['CacheHits']); |
| 455 | + service.set('CacheMisses', resolver.cachestats['CacheMisses']); |
| 456 | + service.end(); |
| 457 | + } |
| 458 | + |
| 459 | + // this is wrong, it contains many types of info: |
| 460 | + // 1. CacheHits, CacheMisses - incremental (added above) |
| 461 | + // 2. QueryHits, QueryMisses - incremental |
| 462 | + // 3. DeleteLRU, DeleteTTL - incremental |
| 463 | + // 4. CacheNodes, CacheBuckets - absolute |
| 464 | + // 5. TreeMemTotal, TreeMemInUse - absolute |
| 465 | + // 6. HeapMemMax, HeapMemTotal, HeapMemInUse - absolute |
| 466 | + //if(typeof resolver.cachestats !== 'undefined') |
| 467 | + // service.module.chartFromMembers(service, resolver.cachestats, 'view_resolver_cachestats_' + x, 'Bind, ' + x + ' View, Cache Statistics', 'requests/s', 'named', 'named', netdata.chartTypes.line, 8000, netdata.chartAlgorithms.incremental, 1, 1); |
| 468 | + |
| 469 | + //if(typeof resolver.adb !== 'undefined') |
| 470 | + // service.module.chartFromMembers(service, resolver.adb, 'view_resolver_adb_' + x, 'Bind, ' + x + ' View, ADB Statistics', 'entries', 'named', 'named', netdata.chartTypes.line, 8500, netdata.chartAlgorithms.absolute, 1, 1); |
406 | 471 | } |
407 | 472 | } |
408 | 473 | } |
|
0 commit comments