@cryptotaxi247 / netdata-1 / commits / a23be5f04

python.d remove bind_rndc (#17628)

Ilya Mashchenko committed May 9, 2024 at 17:10 UTC a23be5f046be0a4aa60415dd812e4800cf72dc91
7 files changed -781
CMakeLists.txt
-2
@@ -2723,7 +2723,6 @@ install(FILES
2723 src/collectors/python.d.plugin/am2320/am2320.conf
2724 src/collectors/python.d.plugin/anomalies/anomalies.conf
2725 src/collectors/python.d.plugin/beanstalk/beanstalk.conf
2726 - src/collectors/python.d.plugin/bind_rndc/bind_rndc.conf
2726 src/collectors/python.d.plugin/boinc/boinc.conf
2727 src/collectors/python.d.plugin/ceph/ceph.conf
2728 src/collectors/python.d.plugin/changefinder/changefinder.conf
@@ -2767,7 +2766,6 @@ install(FILES
2766 src/collectors/python.d.plugin/am2320/am2320.chart.py
2767 src/collectors/python.d.plugin/anomalies/anomalies.chart.py
2768 src/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
2770 - src/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
2769 src/collectors/python.d.plugin/boinc/boinc.chart.py
2770 src/collectors/python.d.plugin/ceph/ceph.chart.py
2771 src/collectors/python.d.plugin/changefinder/changefinder.chart.py
src/collectors/python.d.plugin/bind_rndc/README.md deleted
-1
@@ -1 +0,0 @@
1 -integrations/isc_bind_rndc.md
\ No newline at end of file
src/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py deleted
-252
@@ -1,252 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: bind rndc netdata python.d module
3 -# Author: ilyam8
4 -# SPDX-License-Identifier: GPL-3.0-or-later
5 -
6 -import os
7 -from collections import defaultdict
8 -from subprocess import Popen
9 -
10 -from bases.FrameworkServices.SimpleService import SimpleService
11 -from bases.collection import find_binary
12 -
13 -update_every = 30
14 -
15 -ORDER = [
16 - 'name_server_statistics',
17 - 'incoming_queries',
18 - 'outgoing_queries',
19 - 'named_stats_size',
20 -]
21 -
22 -CHARTS = {
23 - 'name_server_statistics': {
24 - 'options': [None, 'Name Server Statistics', 'stats', 'name server statistics',
25 - 'bind_rndc.name_server_statistics', 'line'],
26 - 'lines': [
27 - ['nms_requests', 'requests', 'incremental'],
28 - ['nms_rejected_queries', 'rejected_queries', 'incremental'],
29 - ['nms_success', 'success', 'incremental'],
30 - ['nms_failure', 'failure', 'incremental'],
31 - ['nms_responses', 'responses', 'incremental'],
32 - ['nms_duplicate', 'duplicate', 'incremental'],
33 - ['nms_recursion', 'recursion', 'incremental'],
34 - ['nms_nxrrset', 'nxrrset', 'incremental'],
35 - ['nms_nxdomain', 'nxdomain', 'incremental'],
36 - ['nms_non_auth_answer', 'non_auth_answer', 'incremental'],
37 - ['nms_auth_answer', 'auth_answer', 'incremental'],
38 - ['nms_dropped_queries', 'dropped_queries', 'incremental'],
39 - ]},
40 - 'incoming_queries': {
41 - 'options': [None, 'Incoming Queries', 'queries', 'incoming queries', 'bind_rndc.incoming_queries', 'line'],
42 - 'lines': [
43 - ]},
44 - 'outgoing_queries': {
45 - 'options': [None, 'Outgoing Queries', 'queries', 'outgoing queries', 'bind_rndc.outgoing_queries', 'line'],
46 - 'lines': [
47 - ]},
48 - 'named_stats_size': {
49 - 'options': [None, 'Named Stats File Size', 'MiB', 'file size', 'bind_rndc.stats_size', 'line'],
50 - 'lines': [
51 - ['stats_size', None, 'absolute', 1, 1 << 20]
52 - ]
53 - }
54 -}
55 -
56 -NMS = {
57 - 'nms_requests': [
58 - 'IPv4 requests received',
59 - 'IPv6 requests received',
60 - 'TCP requests received',
61 - 'requests with EDNS(0) receive'
62 - ],
63 - 'nms_responses': [
64 - 'responses sent',
65 - 'truncated responses sent',
66 - 'responses with EDNS(0) sent',
67 - 'requests with unsupported EDNS version received'
68 - ],
69 - 'nms_failure': [
70 - 'other query failures',
71 - 'queries resulted in SERVFAIL'
72 - ],
73 - 'nms_auth_answer': ['queries resulted in authoritative answer'],
74 - 'nms_non_auth_answer': ['queries resulted in non authoritative answer'],
75 - 'nms_nxrrset': ['queries resulted in nxrrset'],
76 - 'nms_success': ['queries resulted in successful answer'],
77 - 'nms_nxdomain': ['queries resulted in NXDOMAIN'],
78 - 'nms_recursion': ['queries caused recursion'],
79 - 'nms_duplicate': ['duplicate queries received'],
80 - 'nms_rejected_queries': [
81 - 'auth queries rejected',
82 - 'recursive queries rejected'
83 - ],
84 - 'nms_dropped_queries': ['queries dropped']
85 -}
86 -
87 -STATS = ['Name Server Statistics', 'Incoming Queries', 'Outgoing Queries']
88 -
89 -
90 -class Service(SimpleService):
91 - def __init__(self, configuration=None, name=None):
92 - SimpleService.__init__(self, configuration=configuration, name=name)
93 - self.order = ORDER
94 - self.definitions = CHARTS
95 - self.named_stats_path = self.configuration.get('named_stats_path', '/var/log/bind/named.stats')
96 - self.rndc = find_binary('rndc')
97 - self.data = dict(
98 - nms_requests=0,
99 - nms_responses=0,
100 - nms_failure=0,
101 - nms_auth=0,
102 - nms_non_auth=0,
103 - nms_nxrrset=0,
104 - nms_success=0,
105 - nms_nxdomain=0,
106 - nms_recursion=0,
107 - nms_duplicate=0,
108 - nms_rejected_queries=0,
109 - nms_dropped_queries=0,
110 - )
111 -
112 - def check(self):
113 - if not self.rndc:
114 - self.error('Can\'t locate "rndc" binary or binary is not executable by netdata')
115 - return False
116 -
117 - if not (os.path.isfile(self.named_stats_path) and os.access(self.named_stats_path, os.R_OK)):
118 - self.error('Cannot access file %s' % self.named_stats_path)
119 - return False
120 -
121 - run_rndc = Popen([self.rndc, 'stats'], shell=False)
122 - run_rndc.wait()
123 -
124 - if not run_rndc.returncode:
125 - return True
126 - self.error('Not enough permissions to run "%s stats"' % self.rndc)
127 - return False
128 -
129 - def _get_raw_data(self):
130 - """
131 - Run 'rndc stats' and read last dump from named.stats
132 - :return: dict
133 - """
134 - result = dict()
135 - try:
136 - current_size = os.path.getsize(self.named_stats_path)
137 - run_rndc = Popen([self.rndc, 'stats'], shell=False)
138 - run_rndc.wait()
139 -
140 - if run_rndc.returncode:
141 - return None
142 - with open(self.named_stats_path) as named_stats:
143 - named_stats.seek(current_size)
144 - result['stats'] = named_stats.readlines()
145 - result['size'] = current_size
146 - return result
147 - except (OSError, IOError):
148 - return None
149 -
150 - def _get_data(self):
151 - """
152 - Parse data from _get_raw_data()
153 - :return: dict
154 - """
155 -
156 - raw_data = self._get_raw_data()
157 -
158 - if raw_data is None:
159 - return None
160 - parsed = dict()
161 - for stat in STATS:
162 - parsed[stat] = parse_stats(field=stat,
163 - named_stats=raw_data['stats'])
164 -
165 - self.data.update(nms_mapper(data=parsed['Name Server Statistics']))
166 -
167 - for elem in zip(['Incoming Queries', 'Outgoing Queries'], ['incoming_queries', 'outgoing_queries']):
168 - parsed_key, chart_name = elem[0], elem[1]
169 - for dimension_id, value in queries_mapper(data=parsed[parsed_key],
170 - add=chart_name[:9]).items():
171 -
172 - if dimension_id not in self.data:
173 - dimension = dimension_id.replace(chart_name[:9], '')
174 - if dimension_id not in self.charts[chart_name]:
175 - self.charts[chart_name].add_dimension([dimension_id, dimension, 'incremental'])
176 -
177 - self.data[dimension_id] = value
178 -
179 - self.data['stats_size'] = raw_data['size']
180 - return self.data
181 -
182 -
183 -def parse_stats(field, named_stats):
184 - """
185 - :param field: str:
186 - :param named_stats: list:
187 - :return: dict
188 -
189 - Example:
190 - filed: 'Incoming Queries'
191 - names_stats (list of lines):
192 - ++ Incoming Requests ++
193 - 1405660 QUERY
194 - 3 NOTIFY
195 - ++ Incoming Queries ++
196 - 1214961 A
197 - 75 NS
198 - 2 CNAME
199 - 2897 SOA
200 - 35544 PTR
201 - 14 MX
202 - 5822 TXT
203 - 145974 AAAA
204 - 371 SRV
205 - ++ Outgoing Queries ++
206 - ...
207 -
208 - result:
209 - {'A', 1214961, 'NS': 75, 'CNAME': 2, 'SOA': 2897, ...}
210 - """
211 - data = dict()
212 - ns = iter(named_stats)
213 - for line in ns:
214 - if field not in line:
215 - continue
216 - while True:
217 - try:
218 - line = next(ns)
219 - except StopIteration:
220 - break
221 - if '++' not in line:
222 - if '[' in line:
223 - continue
224 - v, k = line.strip().split(' ', 1)
225 - if k not in data:
226 - data[k] = 0
227 - data[k] += int(v)
228 - continue
229 - break
230 - break
231 - return data
232 -
233 -
234 -def nms_mapper(data):
235 - """
236 - :param data: dict
237 - :return: dict(defaultdict)
238 - """
239 - result = defaultdict(int)
240 - for k, v in NMS.items():
241 - for elem in v:
242 - result[k] += data.get(elem, 0)
243 - return result
244 -
245 -
246 -def queries_mapper(data, add):
247 - """
248 - :param data: dict
249 - :param add: str
250 - :return: dict
251 - """
252 - return dict([(add + k, v) for k, v in data.items()])
src/collectors/python.d.plugin/bind_rndc/bind_rndc.conf deleted
-108
@@ -1,108 +0,0 @@
1 -# netdata python.d.plugin configuration for bind_rndc
2 -#
3 -# This file is in YaML format. Generally the format is:
4 -#
5 -# name: value
6 -#
7 -# There are 2 sections:
8 -# - global variables
9 -# - one or more JOBS
10 -#
11 -# JOBS allow you to collect values from multiple sources.
12 -# Each source will have its own set of charts.
13 -#
14 -# JOB parameters have to be indented (using spaces only, example below).
15 -
16 -# ----------------------------------------------------------------------
17 -# Global Variables
18 -# These variables set the defaults for all JOBs, however each JOB
19 -# may define its own, overriding the defaults.
20 -
21 -# update_every sets the default data collection frequency.
22 -# If unset, the python.d.plugin default is used.
23 -# update_every: 1
24 -
25 -# priority controls the order of charts at the netdata dashboard.
26 -# Lower numbers move the charts towards the top of the page.
27 -# If unset, the default for python.d.plugin is used.
28 -# priority: 60000
29 -
30 -# penalty indicates whether to apply penalty to update_every in case of failures.
31 -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes.
32 -# penalty: yes
33 -
34 -# autodetection_retry sets the job re-check interval in seconds.
35 -# The job is not deleted if check fails.
36 -# Attempts to start the job are made once every autodetection_retry.
37 -# This feature is disabled by default.
38 -# autodetection_retry: 0
39 -
40 -# ----------------------------------------------------------------------
41 -# JOBS (data collection sources)
42 -#
43 -# The default JOBS share the same *name*. JOBS with the same name
44 -# are mutually exclusive. Only one of them will be allowed running at
45 -# any time. This allows autodetection to try several alternatives and
46 -# pick the one that works.
47 -#
48 -# Any number of jobs is supported.
49 -#
50 -# All python.d.plugin JOBS (for all its modules) support a set of
51 -# predefined parameters. These are:
52 -#
53 -# job_name:
54 -# name: myname # the JOB's name as it will appear at the
55 -# # dashboard (by default is the job_name)
56 -# # JOBs sharing a name are mutually exclusive
57 -# update_every: 1 # the JOB's data collection frequency
58 -# priority: 60000 # the JOB's order on the dashboard
59 -# penalty: yes # the JOB's penalty
60 -# autodetection_retry: 0 # the JOB's re-check interval in seconds
61 -#
62 -# Additionally to the above, bind_rndc also supports the following:
63 -#
64 -# named_stats_path: 'path to named.stats' # Default: '/var/log/bind/named.stats'
65 -#------------------------------------------------------------------------------------------------------------------
66 -# Important Information
67 -#
68 -# BIND appends logs at EVERY RUN. It is NOT RECOMMENDED to set update_every below 30 sec.
69 -# It is STRONGLY RECOMMENDED to create a bind-rndc.conf file for logrotate.
70 -#
71 -# To set up your BIND to dump stats do the following:
72 -#
73 -# 1. Add to 'named.conf.options' options {}:
74 -# statistics-file "/var/log/bind/named.stats";
75 -#
76 -# 2. Create bind/ directory in /var/log
77 -# cd /var/log/ && mkdir bind
78 -#
79 -# 3. Change owner of directory to 'bind' user
80 -# chown bind bind/
81 -#
82 -# 4. RELOAD (NOT restart) BIND
83 -# systemctl reload bind9.service
84 -#
85 -# 5. Run as a root 'rndc stats' to dump (BIND will create named.stats in new directory)
86 -#
87 -# To allow Netdata to run 'rndc stats' change '/etc/bind/rndc.key' group to netdata
88 -# chown :netdata rndc.key
89 -#
90 -# Last, BUT NOT least, is to create bind-rndc.conf in logrotate.d/:
91 -#
92 -# /var/log/bind/named.stats {
93 -#
94 -# daily
95 -# rotate 4
96 -# compress
97 -# delaycompress
98 -# create 0644 bind bind
99 -# missingok
100 -# postrotate
101 -# rndc reload > /dev/null
102 -# endscript
103 -# }
104 -#
105 -# To test your logrotate conf file run as root:
106 -# logrotate /etc/logrotate.d/bind-rndc -d (debug dry-run mode)
107 -#
108 -# ----------------------------------------------------------------------
src/collectors/python.d.plugin/bind_rndc/integrations/isc_bind_rndc.md deleted
-215
@@ -1,215 +0,0 @@
1 -<!--startmeta
2 -custom_edit_url: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/bind_rndc/README.md"
3 -meta_yaml: "https://github.com/netdata/netdata/edit/master/src/collectors/python.d.plugin/bind_rndc/metadata.yaml"
4 -sidebar_label: "ISC Bind (RNDC)"
5 -learn_status: "Published"
6 -learn_rel_path: "Collecting Metrics/DNS and DHCP Servers"
7 -most_popular: False
8 -message: "DO NOT EDIT THIS FILE DIRECTLY, IT IS GENERATED BY THE COLLECTOR'S metadata.yaml FILE"
9 -endmeta-->
10 -
11 -# ISC Bind (RNDC)
12 -
13 -
14 -<img src="https://netdata.cloud/img/isc.png" width="150"/>
15 -
16 -
17 -Plugin: python.d.plugin
18 -Module: bind_rndc
19 -
20 -<img src="https://img.shields.io/badge/maintained%20by-Netdata-%2300ab44" />
21 -
22 -## Overview
23 -
24 -Monitor ISCBind (RNDC) performance for optimal DNS server operations. Monitor query rates, response times, and error rates to ensure reliable DNS service delivery.
25 -
26 -This collector uses the `rndc` tool to dump (named.stats) statistics then read them to gather Bind Name Server summary performance metrics.
27 -
28 -This collector is supported on all platforms.
29 -
30 -This collector only supports collecting metrics from a single instance of this integration.
31 -
32 -
33 -### Default Behavior
34 -
35 -#### Auto-Detection
36 -
37 -If no configuration is given, the collector will attempt to read named.stats file at `/var/log/bind/named.stats`
38 -
39 -#### Limits
40 -
41 -The default configuration for this integration does not impose any limits on data collection.
42 -
43 -#### Performance Impact
44 -
45 -The default configuration for this integration is not expected to impose a significant performance impact on the system.
46 -
47 -
48 -## Metrics
49 -
50 -Metrics grouped by *scope*.
51 -
52 -The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.
53 -
54 -
55 -
56 -### Per ISC Bind (RNDC) instance
57 -
58 -These metrics refer to the entire monitored application.
59 -
60 -This scope has no labels.
61 -
62 -Metrics:
63 -
64 -| Metric | Dimensions | Unit |
65 -|:------|:----------|:----|
66 -| bind_rndc.name_server_statistics | requests, rejected_queries, success, failure, responses, duplicate, recursion, nxrrset, nxdomain, non_auth_answer, auth_answer, dropped_queries | stats |
67 -| bind_rndc.incoming_queries | a dimension per incoming query type | queries |
68 -| bind_rndc.outgoing_queries | a dimension per outgoing query type | queries |
69 -| bind_rndc.stats_size | stats_size | MiB |
70 -
71 -
72 -
73 -## Alerts
74 -
75 -
76 -The following alerts are available:
77 -
78 -| Alert name | On metric | Description |
79 -|:------------|:----------|:------------|
80 -| [ bind_rndc_stats_file_size ](https://github.com/netdata/netdata/blob/master/src/health/health.d/bind_rndc.conf) | bind_rndc.stats_size | BIND statistics-file size |
81 -
82 -
83 -## Setup
84 -
85 -### Prerequisites
86 -
87 -#### Minimum bind version and permissions
88 -
89 -Version of bind must be >=9.6 and the Netdata user must have permissions to run `rndc stats`
90 -
91 -#### Setup log rotate for bind stats
92 -
93 -BIND appends logs at EVERY RUN. It is NOT RECOMMENDED to set `update_every` below 30 sec.
94 -It is STRONGLY RECOMMENDED to create a `bind-rndc.conf` file for logrotate.
95 -
96 -To set up BIND to dump stats do the following:
97 -
98 -1. Add to 'named.conf.options' options {}:
99 -`statistics-file "/var/log/bind/named.stats";`
100 -
101 -2. Create bind/ directory in /var/log:
102 -`cd /var/log/ && mkdir bind`
103 -
104 -3. Change owner of directory to 'bind' user:
105 -`chown bind bind/`
106 -
107 -4. RELOAD (NOT restart) BIND:
108 -`systemctl reload bind9.service`
109 -
110 -5. Run as a root 'rndc stats' to dump (BIND will create named.stats in new directory)
111 -
112 -To allow Netdata to run 'rndc stats' change '/etc/bind/rndc.key' group to netdata:
113 -`chown :netdata rndc.key`
114 -
115 -Last, BUT NOT least, is to create bind-rndc.conf in logrotate.d/:
116 -```
117 -/var/log/bind/named.stats {
118 -
119 - daily
120 - rotate 4
121 - compress
122 - delaycompress
123 - create 0644 bind bind
124 - missingok
125 - postrotate
126 - rndc reload > /dev/null
127 - endscript
128 -}
129 -```
130 -To test your logrotate conf file run as root:
131 -`logrotate /etc/logrotate.d/bind-rndc -d (debug dry-run mode)`
132 -
133 -
134 -
135 -### Configuration
136 -
137 -#### File
138 -
139 -The configuration file name for this integration is `python.d/bind_rndc.conf`.
140 -
141 -
142 -You can edit the configuration file using the `edit-config` script from the
143 -Netdata [config directory](https://github.com/netdata/netdata/blob/master/docs/netdata-agent/configuration.md#the-netdata-config-directory).
144 -
145 -```bash
146 -cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
147 -sudo ./edit-config python.d/bind_rndc.conf
148 -```
149 -#### Options
150 -
151 -There are 2 sections:
152 -
153 -* Global variables
154 -* One or more JOBS that can define multiple different instances to monitor.
155 -
156 -The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
157 -
158 -Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
159 -
160 -Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
161 -
162 -
163 -<details><summary>Config options</summary>
164 -
165 -| Name | Description | Default | Required |
166 -|:----|:-----------|:-------|:--------:|
167 -| update_every | Sets the default data collection frequency. | 5 | no |
168 -| priority | Controls the order of charts at the netdata dashboard. | 60000 | no |
169 -| autodetection_retry | Sets the job re-check interval in seconds. | 0 | no |
170 -| penalty | Indicates whether to apply penalty to update_every in case of failures. | yes | no |
171 -| name | Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works. | | no |
172 -| named_stats_path | Path to the named stats, after being dumped by `nrdc` | /var/log/bind/named.stats | no |
173 -
174 -</details>
175 -
176 -#### Examples
177 -
178 -##### Local bind stats
179 -
180 -Define a local path to bind stats file
181 -
182 -```yaml
183 -local:
184 - named_stats_path: '/var/log/bind/named.stats'
185 -
186 -```
187 -
188 -
189 -## Troubleshooting
190 -
191 -### Debug Mode
192 -
193 -To troubleshoot issues with the `bind_rndc` collector, run the `python.d.plugin` with the debug option enabled. The output
194 -should give you clues as to why the collector isn't working.
195 -
196 -- Navigate to the `plugins.d` directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on
197 - your system, open `netdata.conf` and look for the `plugins` setting under `[directories]`.
198 -
199 - ```bash
200 - cd /usr/libexec/netdata/plugins.d/
201 - ```
202 -
203 -- Switch to the `netdata` user.
204 -
205 - ```bash
206 - sudo -u netdata -s
207 - ```
208 -
209 -- Run the `python.d.plugin` to debug the collector:
210 -
211 - ```bash
212 - ./python.d.plugin bind_rndc debug trace
213 - ```
214 -
215 -
src/collectors/python.d.plugin/bind_rndc/metadata.yaml deleted
-191
@@ -1,191 +0,0 @@
1 -plugin_name: python.d.plugin
2 -modules:
3 - - meta:
4 - plugin_name: python.d.plugin
5 - module_name: bind_rndc
6 - monitored_instance:
7 - name: ISC Bind (RNDC)
8 - link: "https://www.isc.org/bind/"
9 - categories:
10 - - data-collection.dns-and-dhcp-servers
11 - icon_filename: "isc.png"
12 - related_resources:
13 - integrations:
14 - list: []
15 - info_provided_to_referring_integrations:
16 - description: ""
17 - keywords:
18 - - dns
19 - - bind
20 - - server
21 - most_popular: false
22 - overview:
23 - data_collection:
24 - metrics_description: "Monitor ISCBind (RNDC) performance for optimal DNS server operations. Monitor query rates, response times, and error rates to ensure reliable DNS service delivery."
25 - method_description: "This collector uses the `rndc` tool to dump (named.stats) statistics then read them to gather Bind Name Server summary performance metrics."
26 - supported_platforms:
27 - include: []
28 - exclude: []
29 - multi_instance: false
30 - additional_permissions:
31 - description: ""
32 - default_behavior:
33 - auto_detection:
34 - description: "If no configuration is given, the collector will attempt to read named.stats file at `/var/log/bind/named.stats`"
35 - limits:
36 - description: ""
37 - performance_impact:
38 - description: ""
39 - setup:
40 - prerequisites:
41 - list:
42 - - title: "Minimum bind version and permissions"
43 - description: "Version of bind must be >=9.6 and the Netdata user must have permissions to run `rndc stats`"
44 - - title: "Setup log rotate for bind stats"
45 - description: |
46 - BIND appends logs at EVERY RUN. It is NOT RECOMMENDED to set `update_every` below 30 sec.
47 - It is STRONGLY RECOMMENDED to create a `bind-rndc.conf` file for logrotate.
48 -
49 - To set up BIND to dump stats do the following:
50 -
51 - 1. Add to 'named.conf.options' options {}:
52 - `statistics-file "/var/log/bind/named.stats";`
53 -
54 - 2. Create bind/ directory in /var/log:
55 - `cd /var/log/ && mkdir bind`
56 -
57 - 3. Change owner of directory to 'bind' user:
58 - `chown bind bind/`
59 -
60 - 4. RELOAD (NOT restart) BIND:
61 - `systemctl reload bind9.service`
62 -
63 - 5. Run as a root 'rndc stats' to dump (BIND will create named.stats in new directory)
64 -
65 - To allow Netdata to run 'rndc stats' change '/etc/bind/rndc.key' group to netdata:
66 - `chown :netdata rndc.key`
67 -
68 - Last, BUT NOT least, is to create bind-rndc.conf in logrotate.d/:
69 - ```
70 - /var/log/bind/named.stats {
71 -
72 - daily
73 - rotate 4
74 - compress
75 - delaycompress
76 - create 0644 bind bind
77 - missingok
78 - postrotate
79 - rndc reload > /dev/null
80 - endscript
81 - }
82 - ```
83 - To test your logrotate conf file run as root:
84 - `logrotate /etc/logrotate.d/bind-rndc -d (debug dry-run mode)`
85 - configuration:
86 - file:
87 - name: python.d/bind_rndc.conf
88 - options:
89 - description: |
90 - There are 2 sections:
91 -
92 - * Global variables
93 - * One or more JOBS that can define multiple different instances to monitor.
94 -
95 - The following options can be defined globally: priority, penalty, autodetection_retry, update_every, but can also be defined per JOB to override the global values.
96 -
97 - Additionally, the following collapsed table contains all the options that can be configured inside a JOB definition.
98 -
99 - Every configuration JOB starts with a `job_name` value which will appear in the dashboard, unless a `name` parameter is specified.
100 - folding:
101 - title: "Config options"
102 - enabled: true
103 - list:
104 - - name: update_every
105 - description: Sets the default data collection frequency.
106 - default_value: 5
107 - required: false
108 - - name: priority
109 - description: Controls the order of charts at the netdata dashboard.
110 - default_value: 60000
111 - required: false
112 - - name: autodetection_retry
113 - description: Sets the job re-check interval in seconds.
114 - default_value: 0
115 - required: false
116 - - name: penalty
117 - description: Indicates whether to apply penalty to update_every in case of failures.
118 - default_value: yes
119 - required: false
120 - - name: name
121 - description: Job name. This value will overwrite the `job_name` value. JOBS with the same name are mutually exclusive. Only one of them will be allowed running at any time. This allows autodetection to try several alternatives and pick the one that works.
122 - default_value: ""
123 - required: false
124 - - name: named_stats_path
125 - description: Path to the named stats, after being dumped by `nrdc`
126 - default_value: "/var/log/bind/named.stats"
127 - required: false
128 - examples:
129 - folding:
130 - enabled: false
131 - title: "Config"
132 - list:
133 - - name: Local bind stats
134 - description: Define a local path to bind stats file
135 - config: |
136 - local:
137 - named_stats_path: '/var/log/bind/named.stats'
138 - troubleshooting:
139 - problems:
140 - list: []
141 - alerts:
142 - - name: bind_rndc_stats_file_size
143 - link: https://github.com/netdata/netdata/blob/master/src/health/health.d/bind_rndc.conf
144 - metric: bind_rndc.stats_size
145 - info: BIND statistics-file size
146 - metrics:
147 - folding:
148 - title: Metrics
149 - enabled: false
150 - description: ""
151 - availability: []
152 - scopes:
153 - - name: global
154 - description: "These metrics refer to the entire monitored application."
155 - labels: []
156 - metrics:
157 - - name: bind_rndc.name_server_statistics
158 - description: Name Server Statistics
159 - unit: "stats"
160 - chart_type: line
161 - dimensions:
162 - - name: requests
163 - - name: rejected_queries
164 - - name: success
165 - - name: failure
166 - - name: responses
167 - - name: duplicate
168 - - name: recursion
169 - - name: nxrrset
170 - - name: nxdomain
171 - - name: non_auth_answer
172 - - name: auth_answer
173 - - name: dropped_queries
174 - - name: bind_rndc.incoming_queries
175 - description: Incoming queries
176 - unit: "queries"
177 - chart_type: line
178 - dimensions:
179 - - name: a dimension per incoming query type
180 - - name: bind_rndc.outgoing_queries
181 - description: Outgoing queries
182 - unit: "queries"
183 - chart_type: line
184 - dimensions:
185 - - name: a dimension per outgoing query type
186 - - name: bind_rndc.stats_size
187 - description: Named Stats File Size
188 - unit: "MiB"
189 - chart_type: line
190 - dimensions:
191 - - name: stats_size
src/health/health.d/bind_rndc.conf deleted
-12
@@ -1,12 +0,0 @@
1 - template: bind_rndc_stats_file_size
2 - on: bind_rndc.stats_size
3 - class: Utilization
4 - type: DNS
5 -component: BIND
6 - units: megabytes
7 - every: 60
8 - calc: $stats_size
9 - warn: $this > 512
10 - summary: BIND statistics file size
11 - info: BIND statistics-file size
12 - to: sysadmin