@cryptotaxi247 / netdata-1 / commits / c50c34e90

remove deprecated python.d collectors announced in v1.38.0 (#14454)

Ilya Mashchenko committed Feb 8, 2023 at 10:51 UTC c50c34e905782c0e835a0fa26339e60a70a6812a
16 files changed +1 -1696
collectors/COLLECTORS.md
+1 -4
@@ -222,11 +222,8 @@ configure any of these collectors according to your setup and infrastructure.
222 usage, jobs rates, commands, and more.
223 - [Pulsar](https://github.com/netdata/go.d.plugin/blob/master/modules/pulsar/README.md): Collect summary,
224 namespaces, and topics performance statistics.
225 -- [RabbitMQ (Go)](https://github.com/netdata/go.d.plugin/blob/master/modules/rabbitmq/README.md): Collect message
225 +- [RabbitMQ](https://github.com/netdata/go.d.plugin/blob/master/modules/rabbitmq/README.md): Collect message
226 broker overview, system and per virtual host metrics.
227 -- [RabbitMQ (Python)](https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/rabbitmq/README.md):
228 - Collect message broker global and per virtual
229 - host metrics.
227 - [VerneMQ](https://github.com/netdata/go.d.plugin/blob/master/modules/vernemq/README.md): Monitor MQTT broker
228 health and performance metrics. It collects all available info for both MQTTv3 and v5 communication
229
collectors/python.d.plugin/Makefile.am
-3
@@ -65,14 +65,11 @@ include memcached/Makefile.inc
65 include monit/Makefile.inc
66 include nvidia_smi/Makefile.inc
67 include nsd/Makefile.inc
68 -include ntpd/Makefile.inc
68 include openldap/Makefile.inc
69 include oracledb/Makefile.inc
70 include pandas/Makefile.inc
71 include postfix/Makefile.inc
73 -include proxysql/Makefile.inc
72 include puppet/Makefile.inc
75 -include rabbitmq/Makefile.inc
73 include rethinkdbs/Makefile.inc
74 include retroshare/Makefile.inc
75 include riakkv/Makefile.inc
collectors/python.d.plugin/README.md
-3
@@ -231,9 +231,6 @@ For additional security it uses python `subprocess.Popen` (without `shell=True`
231
232 _Examples: `apache`, `nginx`, `tomcat`_
233
234 -_Multiple Endpoints (urls) Examples: [`rabbitmq`](https://github.com/netdata/netdata/blob/master/collectors/python.d.plugin/rabbitmq/README.md) (simpler).
235 -
236 -
234 _Variables from config file_: `url`, `user`, `pass`.
235
236 If data is grabbed by accessing service via HTTP protocol, this class can be used. It can handle HTTP Basic Auth when specified with `user` and `pass` credentials.
collectors/python.d.plugin/ntpd/Makefile.inc deleted
-13
@@ -1,13 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -# THIS IS NOT A COMPLETE Makefile
4 -# IT IS INCLUDED BY ITS PARENT'S Makefile.am
5 -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
6 -
7 -# install these files
8 -dist_python_DATA += ntpd/ntpd.chart.py
9 -dist_pythonconfig_DATA += ntpd/ntpd.conf
10 -
11 -# do not install these files, but include them in the distribution
12 -dist_noinst_DATA += ntpd/README.md ntpd/Makefile.inc
13 -
collectors/python.d.plugin/ntpd/README.md deleted
-14
@@ -1,14 +0,0 @@
1 -<!--
2 -title: "NTP daemon monitoring with Netdata"
3 -custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/ntpd/README.md"
4 -sidebar_label: "NTP daemon"
5 -learn_status: "Published"
6 -learn_topic_type: "References"
7 -learn_rel_path: "References/Collectors references/Qos"
8 --->
9 -
10 -# NTP daemon monitoring with Netdata
11 -
12 -This collector is deprecated.
13 -Use [go.d/ntpd](https://github.com/netdata/go.d.plugin/tree/master/modules/ntpd#ntp-daemon-monitoring-with-netdata)
14 -instead.
\ No newline at end of file
collectors/python.d.plugin/ntpd/ntpd.chart.py deleted
-387
@@ -1,387 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: ntpd netdata python.d module
3 -# Author: Sven Mäder (rda0)
4 -# Author: Ilya Mashchenko (ilyam8)
5 -# SPDX-License-Identifier: GPL-3.0-or-later
6 -
7 -import re
8 -import struct
9 -
10 -from bases.FrameworkServices.SocketService import SocketService
11 -
12 -disabled_by_default = True
13 -
14 -# NTP Control Message Protocol constants
15 -MODE = 6
16 -HEADER_FORMAT = '!BBHHHHH'
17 -HEADER_LEN = 12
18 -OPCODES = {
19 - 'readstat': 1,
20 - 'readvar': 2
21 -}
22 -
23 -# Maximal dimension precision
24 -PRECISION = 1000000
25 -
26 -# Static charts
27 -ORDER = [
28 - 'sys_offset',
29 - 'sys_jitter',
30 - 'sys_frequency',
31 - 'sys_wander',
32 - 'sys_rootdelay',
33 - 'sys_rootdisp',
34 - 'sys_stratum',
35 - 'sys_tc',
36 - 'sys_precision',
37 - 'peer_offset',
38 - 'peer_delay',
39 - 'peer_dispersion',
40 - 'peer_jitter',
41 - 'peer_xleave',
42 - 'peer_rootdelay',
43 - 'peer_rootdisp',
44 - 'peer_stratum',
45 - 'peer_hmode',
46 - 'peer_pmode',
47 - 'peer_hpoll',
48 - 'peer_ppoll',
49 - 'peer_precision'
50 -]
51 -
52 -CHARTS = {
53 - 'sys_offset': {
54 - 'options': [None, 'Combined offset of server relative to this host', 'milliseconds',
55 - 'system', 'ntpd.sys_offset', 'area'],
56 - 'lines': [
57 - ['offset', 'offset', 'absolute', 1, PRECISION]
58 - ]
59 - },
60 - 'sys_jitter': {
61 - 'options': [None, 'Combined system jitter and clock jitter', 'milliseconds',
62 - 'system', 'ntpd.sys_jitter', 'line'],
63 - 'lines': [
64 - ['sys_jitter', 'system', 'absolute', 1, PRECISION],
65 - ['clk_jitter', 'clock', 'absolute', 1, PRECISION]
66 - ]
67 - },
68 - 'sys_frequency': {
69 - 'options': [None, 'Frequency offset relative to hardware clock', 'ppm', 'system', 'ntpd.sys_frequency', 'area'],
70 - 'lines': [
71 - ['frequency', 'frequency', 'absolute', 1, PRECISION]
72 - ]
73 - },
74 - 'sys_wander': {
75 - 'options': [None, 'Clock frequency wander', 'ppm', 'system', 'ntpd.sys_wander', 'area'],
76 - 'lines': [
77 - ['clk_wander', 'clock', 'absolute', 1, PRECISION]
78 - ]
79 - },
80 - 'sys_rootdelay': {
81 - 'options': [None, 'Total roundtrip delay to the primary reference clock', 'milliseconds', 'system',
82 - 'ntpd.sys_rootdelay', 'area'],
83 - 'lines': [
84 - ['rootdelay', 'delay', 'absolute', 1, PRECISION]
85 - ]
86 - },
87 - 'sys_rootdisp': {
88 - 'options': [None, 'Total root dispersion to the primary reference clock', 'milliseconds', 'system',
89 - 'ntpd.sys_rootdisp', 'area'],
90 - 'lines': [
91 - ['rootdisp', 'dispersion', 'absolute', 1, PRECISION]
92 - ]
93 - },
94 - 'sys_stratum': {
95 - 'options': [None, 'Stratum (1-15)', 'stratum', 'system', 'ntpd.sys_stratum', 'line'],
96 - 'lines': [
97 - ['stratum', 'stratum', 'absolute', 1, PRECISION]
98 - ]
99 - },
100 - 'sys_tc': {
101 - 'options': [None, 'Time constant and poll exponent (3-17)', 'log2 s', 'system', 'ntpd.sys_tc', 'line'],
102 - 'lines': [
103 - ['tc', 'current', 'absolute', 1, PRECISION],
104 - ['mintc', 'minimum', 'absolute', 1, PRECISION]
105 - ]
106 - },
107 - 'sys_precision': {
108 - 'options': [None, 'Precision', 'log2 s', 'system', 'ntpd.sys_precision', 'line'],
109 - 'lines': [
110 - ['precision', 'precision', 'absolute', 1, PRECISION]
111 - ]
112 - }
113 -}
114 -
115 -PEER_CHARTS = {
116 - 'peer_offset': {
117 - 'options': [None, 'Filter offset', 'milliseconds', 'peers', 'ntpd.peer_offset', 'line'],
118 - 'lines': []
119 - },
120 - 'peer_delay': {
121 - 'options': [None, 'Filter delay', 'milliseconds', 'peers', 'ntpd.peer_delay', 'line'],
122 - 'lines': []
123 - },
124 - 'peer_dispersion': {
125 - 'options': [None, 'Filter dispersion', 'milliseconds', 'peers', 'ntpd.peer_dispersion', 'line'],
126 - 'lines': []
127 - },
128 - 'peer_jitter': {
129 - 'options': [None, 'Filter jitter', 'milliseconds', 'peers', 'ntpd.peer_jitter', 'line'],
130 - 'lines': []
131 - },
132 - 'peer_xleave': {
133 - 'options': [None, 'Interleave delay', 'milliseconds', 'peers', 'ntpd.peer_xleave', 'line'],
134 - 'lines': []
135 - },
136 - 'peer_rootdelay': {
137 - 'options': [None, 'Total roundtrip delay to the primary reference clock', 'milliseconds', 'peers',
138 - 'ntpd.peer_rootdelay', 'line'],
139 - 'lines': []
140 - },
141 - 'peer_rootdisp': {
142 - 'options': [None, 'Total root dispersion to the primary reference clock', 'ms', 'peers',
143 - 'ntpd.peer_rootdisp', 'line'],
144 - 'lines': []
145 - },
146 - 'peer_stratum': {
147 - 'options': [None, 'Stratum (1-15)', 'stratum', 'peers', 'ntpd.peer_stratum', 'line'],
148 - 'lines': []
149 - },
150 - 'peer_hmode': {
151 - 'options': [None, 'Host mode (1-6)', 'hmode', 'peers', 'ntpd.peer_hmode', 'line'],
152 - 'lines': []
153 - },
154 - 'peer_pmode': {
155 - 'options': [None, 'Peer mode (1-5)', 'pmode', 'peers', 'ntpd.peer_pmode', 'line'],
156 - 'lines': []
157 - },
158 - 'peer_hpoll': {
159 - 'options': [None, 'Host poll exponent', 'log2 s', 'peers', 'ntpd.peer_hpoll', 'line'],
160 - 'lines': []
161 - },
162 - 'peer_ppoll': {
163 - 'options': [None, 'Peer poll exponent', 'log2 s', 'peers', 'ntpd.peer_ppoll', 'line'],
164 - 'lines': []
165 - },
166 - 'peer_precision': {
167 - 'options': [None, 'Precision', 'log2 s', 'peers', 'ntpd.peer_precision', 'line'],
168 - 'lines': []
169 - }
170 -}
171 -
172 -
173 -class Base:
174 - regex = re.compile(r'([a-z_]+)=((?:-)?[0-9]+(?:\.[0-9]+)?)')
175 -
176 - @staticmethod
177 - def get_header(associd=0, operation='readvar'):
178 - """
179 - Constructs the NTP Control Message header:
180 - 0 1 2 3
181 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
182 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
183 - |LI | VN |Mode |R|E|M| OpCode | Sequence Number |
184 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
185 - | Status | Association ID |
186 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
187 - | Offset | Count |
188 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
189 - """
190 - version = 2
191 - sequence = 1
192 - status = 0
193 - offset = 0
194 - count = 0
195 - header = struct.pack(HEADER_FORMAT, (version << 3 | MODE), OPCODES[operation],
196 - sequence, status, associd, offset, count)
197 - return header
198 -
199 -
200 -class System(Base):
201 - def __init__(self):
202 - self.request = self.get_header()
203 -
204 - def get_data(self, raw):
205 - """
206 - Extracts key=value pairs with float/integer from ntp response packet data.
207 - """
208 - data = dict()
209 - for key, value in self.regex.findall(raw):
210 - data[key] = float(value) * PRECISION
211 - return data
212 -
213 -
214 -class Peer(Base):
215 - def __init__(self, idx, name):
216 - self.id = idx
217 - self.real_name = name
218 - self.name = name.replace('.', '_')
219 - self.request = self.get_header(self.id)
220 -
221 - def get_data(self, raw):
222 - """
223 - Extracts key=value pairs with float/integer from ntp response packet data.
224 - """
225 - data = dict()
226 - for key, value in self.regex.findall(raw):
227 - dimension = '_'.join([self.name, key])
228 - data[dimension] = float(value) * PRECISION
229 - return data
230 -
231 -
232 -class Service(SocketService):
233 - def __init__(self, configuration=None, name=None):
234 - SocketService.__init__(self, configuration=configuration, name=name)
235 - self.order = list(ORDER)
236 - self.definitions = dict(CHARTS)
237 - self.port = 'ntp'
238 - self.dgram_socket = True
239 - self.system = System()
240 - self.peers = dict()
241 - self.request = str()
242 - self.retries = 0
243 - self.show_peers = self.configuration.get('show_peers', False)
244 - self.peer_rescan = self.configuration.get('peer_rescan', 60)
245 - if self.show_peers:
246 - self.definitions.update(PEER_CHARTS)
247 -
248 - def check(self):
249 - """
250 - Checks if we can get valid systemvars.
251 - If not, returns None to disable module.
252 - """
253 - self._parse_config()
254 -
255 - peer_filter = self.configuration.get('peer_filter', r'127\..*')
256 - try:
257 - self.peer_filter = re.compile(r'^((0\.0\.0\.0)|({0}))$'.format(peer_filter))
258 - except re.error as error:
259 - self.error('Compile pattern error (peer_filter) : {0}'.format(error))
260 - return None
261 -
262 - self.request = self.system.request
263 - raw_systemvars = self._get_raw_data()
264 -
265 - if not self.system.get_data(raw_systemvars):
266 - return None
267 -
268 - return True
269 -
270 - def get_data(self):
271 - """
272 - Gets systemvars data on each update.
273 - Gets peervars data for all peers on each update.
274 - """
275 - data = dict()
276 -
277 - self.request = self.system.request
278 - raw = self._get_raw_data()
279 - if not raw:
280 - return None
281 -
282 - data.update(self.system.get_data(raw))
283 -
284 - if not self.show_peers:
285 - return data
286 -
287 - if not self.peers or self.runs_counter % self.peer_rescan == 0 or self.retries > 8:
288 - self.find_new_peers()
289 -
290 - for peer in self.peers.values():
291 - self.request = peer.request
292 - peer_data = peer.get_data(self._get_raw_data())
293 - if peer_data:
294 - data.update(peer_data)
295 - else:
296 - self.retries += 1
297 -
298 - return data
299 -
300 - def find_new_peers(self):
301 - new_peers = dict((p.real_name, p) for p in self.get_peers())
302 - if new_peers:
303 -
304 - peers_to_remove = set(self.peers) - set(new_peers)
305 - peers_to_add = set(new_peers) - set(self.peers)
306 -
307 - for peer_name in peers_to_remove:
308 - self.hide_old_peer_from_charts(self.peers[peer_name])
309 - del self.peers[peer_name]
310 -
311 - for peer_name in peers_to_add:
312 - self.add_new_peer_to_charts(new_peers[peer_name])
313 -
314 - self.peers.update(new_peers)
315 - self.retries = 0
316 -
317 - def add_new_peer_to_charts(self, peer):
318 - for chart_id in set(self.charts.charts) & set(PEER_CHARTS):
319 - dim_id = peer.name + chart_id[4:]
320 - if dim_id not in self.charts[chart_id]:
321 - self.charts[chart_id].add_dimension([dim_id, peer.real_name, 'absolute', 1, PRECISION])
322 - else:
323 - self.charts[chart_id].hide_dimension(dim_id, reverse=True)
324 -
325 - def hide_old_peer_from_charts(self, peer):
326 - for chart_id in set(self.charts.charts) & set(PEER_CHARTS):
327 - dim_id = peer.name + chart_id[4:]
328 - self.charts[chart_id].hide_dimension(dim_id)
329 -
330 - def get_peers(self):
331 - self.request = Base.get_header(operation='readstat')
332 -
333 - raw_data = self._get_raw_data(raw=True)
334 - if not raw_data:
335 - return list()
336 -
337 - peer_ids = self.get_peer_ids(raw_data)
338 - if not peer_ids:
339 - return list()
340 -
341 - new_peers = list()
342 - for peer_id in peer_ids:
343 - self.request = Base.get_header(peer_id)
344 - raw_peer_data = self._get_raw_data()
345 - if not raw_peer_data:
346 - continue
347 - srcadr = re.search(r'(srcadr)=([^,]+)', raw_peer_data)
348 - if not srcadr:
349 - continue
350 - srcadr = srcadr.group(2)
351 - if self.peer_filter.search(srcadr):
352 - continue
353 - stratum = re.search(r'(stratum)=([^,]+)', raw_peer_data)
354 - if not stratum:
355 - continue
356 - if int(stratum.group(2)) > 15:
357 - continue
358 -
359 - new_peer = Peer(idx=peer_id, name=srcadr)
360 - new_peers.append(new_peer)
361 - return new_peers
362 -
363 - def get_peer_ids(self, res):
364 - """
365 - Unpack the NTP Control Message header
366 - Get data length from header
367 - Get list of association ids returned in the readstat response
368 - """
369 -
370 - try:
371 - count = struct.unpack(HEADER_FORMAT, res[:HEADER_LEN])[6]
372 - except struct.error as error:
373 - self.error('error unpacking header: {0}'.format(error))
374 - return None
375 - if not count:
376 - self.error('empty data field in NTP control packet')
377 - return None
378 -
379 - data_end = HEADER_LEN + count
380 - data = res[HEADER_LEN:data_end]
381 - data_format = ''.join(['!', 'H' * int(count / 2)])
382 - try:
383 - peer_ids = list(struct.unpack(data_format, data))[::2]
384 - except struct.error as error:
385 - self.error('error unpacking data: {0}'.format(error))
386 - return None
387 - return peer_ids
collectors/python.d.plugin/ntpd/ntpd.conf deleted
-89
@@ -1,89 +0,0 @@
1 -# netdata python.d.plugin configuration for ntpd
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 -# ----------------------------------------------------------------------
35 -# JOBS (data collection sources)
36 -#
37 -# The default JOBS share the same *name*. JOBS with the same name
38 -# are mutually exclusive. Only one of them will be allowed running at
39 -# any time. This allows autodetection to try several alternatives and
40 -# pick the one that works.
41 -#
42 -# Any number of jobs is supported.
43 -#
44 -# All python.d.plugin JOBS (for all its modules) support a set of
45 -# predefined parameters. These are:
46 -#
47 -# job_name:
48 -# name: myname # the JOB's name as it will appear at the
49 -# # dashboard (by default is the job_name)
50 -# # JOBs sharing a name are mutually exclusive
51 -# update_every: 1 # the JOB's data collection frequency
52 -# priority: 60000 # the JOB's order on the dashboard
53 -# penalty: yes # the JOB's penalty
54 -#
55 -# Additionally to the above, ntp also supports the following:
56 -#
57 -# host: 'localhost' # the host to query
58 -# port: '123' # the UDP port where `ntpd` listens
59 -# show_peers: no # use `yes` to show peer charts. enabling this
60 -# # option is recommended only for debugging, as
61 -# # it could possibly imply memory leaks if the
62 -# # peers change frequently.
63 -# peer_filter: '127\..*' # regex to exclude peers
64 -# # by default local peers are hidden
65 -# # use `''` to show all peers.
66 -# peer_rescan: 60 # interval (>0) to check for new/changed peers
67 -# # use `1` to check on every update
68 -#
69 -# ----------------------------------------------------------------------
70 -# AUTO-DETECTION JOBS
71 -# only one of them will run (they have the same name)
72 -
73 -localhost:
74 - name: 'local'
75 - host: 'localhost'
76 - port: '123'
77 - show_peers: no
78 -
79 -localhost_ipv4:
80 - name: 'local'
81 - host: '127.0.0.1'
82 - port: '123'
83 - show_peers: no
84 -
85 -localhost_ipv6:
86 - name: 'local'
87 - host: '::1'
88 - port: '123'
89 - show_peers: no
collectors/python.d.plugin/proxysql/Makefile.inc deleted
-13
@@ -1,13 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -# THIS IS NOT A COMPLETE Makefile
4 -# IT IS INCLUDED BY ITS PARENT'S Makefile.am
5 -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
6 -
7 -# install these files
8 -dist_python_DATA += proxysql/proxysql.chart.py
9 -dist_pythonconfig_DATA += proxysql/proxysql.conf
10 -
11 -# do not install these files, but include them in the distribution
12 -dist_noinst_DATA += proxysql/README.md proxysql/Makefile.inc
13 -
collectors/python.d.plugin/proxysql/README.md deleted
-14
@@ -1,14 +0,0 @@
1 -<!--
2 -title: "ProxySQL monitoring with Netdata"
3 -custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/proxysql/README.md"
4 -sidebar_label: "proxysql-python.d.plugin"
5 -learn_status: "Published"
6 -learn_topic_type: "References"
7 -learn_rel_path: "References/Collectors references/Databases"
8 --->
9 -
10 -# ProxySQL monitoring with Netdata
11 -
12 -This collector is deprecated.
13 -Use [go.d/proxysql](https://github.com/netdata/go.d.plugin/tree/master/modules/proxysql#proxysql-monitoring-with-netdata)
14 -instead.
\ No newline at end of file
collectors/python.d.plugin/proxysql/proxysql.chart.py deleted
-354
@@ -1,354 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: Proxysql netdata python.d module
3 -# Author: Ali Borhani (alibo)
4 -# SPDX-License-Identifier: GPL-3.0+
5 -
6 -from bases.FrameworkServices.MySQLService import MySQLService
7 -
8 -
9 -disabled_by_default = True
10 -
11 -def query(table, *params):
12 - return 'SELECT {params} FROM {table}'.format(table=table, params=', '.join(params))
13 -
14 -
15 -# https://github.com/sysown/proxysql/blob/master/doc/admin_tables.md#stats_mysql_global
16 -QUERY_GLOBAL = query(
17 - "stats_mysql_global",
18 - "Variable_Name",
19 - "Variable_Value"
20 -)
21 -
22 -# https://github.com/sysown/proxysql/blob/master/doc/admin_tables.md#stats_mysql_connection_pool
23 -QUERY_CONNECTION_POOL = query(
24 - "stats_mysql_connection_pool",
25 - "hostgroup",
26 - "srv_host",
27 - "srv_port",
28 - "status",
29 - "ConnUsed",
30 - "ConnFree",
31 - "ConnOK",
32 - "ConnERR",
33 - "Queries",
34 - "Bytes_data_sent",
35 - "Bytes_data_recv",
36 - "Latency_us"
37 -)
38 -
39 -# https://github.com/sysown/proxysql/blob/master/doc/admin_tables.md#stats_mysql_commands_counters
40 -QUERY_COMMANDS = query(
41 - "stats_mysql_commands_counters",
42 - "Command",
43 - "Total_Time_us",
44 - "Total_cnt",
45 - "cnt_100us",
46 - "cnt_500us",
47 - "cnt_1ms",
48 - "cnt_5ms",
49 - "cnt_10ms",
50 - "cnt_50ms",
51 - "cnt_100ms",
52 - "cnt_500ms",
53 - "cnt_1s",
54 - "cnt_5s",
55 - "cnt_10s",
56 - "cnt_INFs"
57 -)
58 -
59 -GLOBAL_STATS = [
60 - 'client_connections_aborted',
61 - 'client_connections_connected',
62 - 'client_connections_created',
63 - 'client_connections_non_idle',
64 - 'proxysql_uptime',
65 - 'questions',
66 - 'slow_queries'
67 -]
68 -
69 -CONNECTION_POOL_STATS = [
70 - 'status',
71 - 'connused',
72 - 'connfree',
73 - 'connok',
74 - 'connerr',
75 - 'queries',
76 - 'bytes_data_sent',
77 - 'bytes_data_recv',
78 - 'latency_us'
79 -]
80 -
81 -ORDER = [
82 - 'connections',
83 - 'active_transactions',
84 - 'questions',
85 - 'pool_overall_net',
86 - 'commands_count',
87 - 'commands_duration',
88 - 'pool_status',
89 - 'pool_net',
90 - 'pool_queries',
91 - 'pool_latency',
92 - 'pool_connection_used',
93 - 'pool_connection_free',
94 - 'pool_connection_ok',
95 - 'pool_connection_error'
96 -]
97 -
98 -HISTOGRAM_ORDER = [
99 - '100us',
100 - '500us',
101 - '1ms',
102 - '5ms',
103 - '10ms',
104 - '50ms',
105 - '100ms',
106 - '500ms',
107 - '1s',
108 - '5s',
109 - '10s',
110 - 'inf'
111 -]
112 -
113 -STATUS = {
114 - "ONLINE": 1,
115 - "SHUNNED": 2,
116 - "OFFLINE_SOFT": 3,
117 - "OFFLINE_HARD": 4
118 -}
119 -
120 -CHARTS = {
121 - 'pool_status': {
122 - 'options': [None, 'ProxySQL Backend Status', 'status', 'status', 'proxysql.pool_status', 'line'],
123 - 'lines': []
124 - },
125 - 'pool_net': {
126 - 'options': [None, 'ProxySQL Backend Bandwidth', 'kilobits/s', 'bandwidth', 'proxysql.pool_net', 'area'],
127 - 'lines': []
128 - },
129 - 'pool_overall_net': {
130 - 'options': [None, 'ProxySQL Backend Overall Bandwidth', 'kilobits/s', 'overall_bandwidth',
131 - 'proxysql.pool_overall_net', 'area'],
132 - 'lines': [
133 - ['bytes_data_recv', 'in', 'incremental', 8, 1000],
134 - ['bytes_data_sent', 'out', 'incremental', -8, 1000]
135 - ]
136 - },
137 - 'questions': {
138 - 'options': [None, 'ProxySQL Frontend Questions', 'questions/s', 'questions', 'proxysql.questions', 'line'],
139 - 'lines': [
140 - ['questions', 'questions', 'incremental'],
141 - ['slow_queries', 'slow_queries', 'incremental']
142 - ]
143 - },
144 - 'pool_queries': {
145 - 'options': [None, 'ProxySQL Backend Queries', 'queries/s', 'queries', 'proxysql.queries', 'line'],
146 - 'lines': []
147 - },
148 - 'active_transactions': {
149 - 'options': [None, 'ProxySQL Frontend Active Transactions', 'transactions/s', 'active_transactions',
150 - 'proxysql.active_transactions', 'line'],
151 - 'lines': [
152 - ['active_transactions', 'active_transactions', 'absolute']
153 - ]
154 - },
155 - 'pool_latency': {
156 - 'options': [None, 'ProxySQL Backend Latency', 'milliseconds', 'latency', 'proxysql.latency', 'line'],
157 - 'lines': []
158 - },
159 - 'connections': {
160 - 'options': [None, 'ProxySQL Frontend Connections', 'connections/s', 'connections', 'proxysql.connections',
161 - 'line'],
162 - 'lines': [
163 - ['client_connections_connected', 'connected', 'absolute'],
164 - ['client_connections_created', 'created', 'incremental'],
165 - ['client_connections_aborted', 'aborted', 'incremental'],
166 - ['client_connections_non_idle', 'non_idle', 'absolute']
167 - ]
168 - },
169 - 'pool_connection_used': {
170 - 'options': [None, 'ProxySQL Used Connections', 'connections', 'pool_connections',
171 - 'proxysql.pool_used_connections', 'line'],
172 - 'lines': []
173 - },
174 - 'pool_connection_free': {
175 - 'options': [None, 'ProxySQL Free Connections', 'connections', 'pool_connections',
176 - 'proxysql.pool_free_connections', 'line'],
177 - 'lines': []
178 - },
179 - 'pool_connection_ok': {
180 - 'options': [None, 'ProxySQL Established Connections', 'connections', 'pool_connections',
181 - 'proxysql.pool_ok_connections', 'line'],
182 - 'lines': []
183 - },
184 - 'pool_connection_error': {
185 - 'options': [None, 'ProxySQL Error Connections', 'connections', 'pool_connections',
186 - 'proxysql.pool_error_connections', 'line'],
187 - 'lines': []
188 - },
189 - 'commands_count': {
190 - 'options': [None, 'ProxySQL Commands', 'commands', 'commands', 'proxysql.commands_count', 'line'],
191 - 'lines': []
192 - },
193 - 'commands_duration': {
194 - 'options': [None, 'ProxySQL Commands Duration', 'milliseconds', 'commands', 'proxysql.commands_duration',
195 - 'line'],
196 - 'lines': []
197 - }
198 -}
199 -
200 -
201 -class Service(MySQLService):
202 - def __init__(self, configuration=None, name=None):
203 - MySQLService.__init__(self, configuration=configuration, name=name)
204 - self.order = ORDER
205 - self.definitions = CHARTS
206 - self.queries = dict(
207 - global_status=QUERY_GLOBAL,
208 - connection_pool_status=QUERY_CONNECTION_POOL,
209 - commands_status=QUERY_COMMANDS
210 - )
211 -
212 - def _get_data(self):
213 - raw_data = self._get_raw_data(description=True)
214 -
215 - if not raw_data:
216 - return None
217 -
218 - to_netdata = dict()
219 -
220 - if 'global_status' in raw_data:
221 - global_status = dict(raw_data['global_status'][0])
222 - for key in global_status:
223 - if key.lower() in GLOBAL_STATS:
224 - to_netdata[key.lower()] = global_status[key]
225 -
226 - if 'connection_pool_status' in raw_data:
227 -
228 - to_netdata['bytes_data_recv'] = 0
229 - to_netdata['bytes_data_sent'] = 0
230 -
231 - for record in raw_data['connection_pool_status'][0]:
232 - backend = self.generate_backend(record)
233 - name = self.generate_backend_name(backend)
234 -
235 - for key in backend:
236 - if key in CONNECTION_POOL_STATS:
237 - if key == 'status':
238 - backend[key] = self.convert_status(backend[key])
239 -
240 - if len(self.charts) > 0:
241 - if (name + '_status') not in self.charts['pool_status']:
242 - self.add_backend_dimensions(name)
243 -
244 - to_netdata["{0}_{1}".format(name, key)] = backend[key]
245 -
246 - if key == 'bytes_data_recv':
247 - to_netdata['bytes_data_recv'] += int(backend[key])
248 -
249 - if key == 'bytes_data_sent':
250 - to_netdata['bytes_data_sent'] += int(backend[key])
251 -
252 - if 'commands_status' in raw_data:
253 - for record in raw_data['commands_status'][0]:
254 - cmd = self.generate_command_stats(record)
255 - name = cmd['name']
256 -
257 - if len(self.charts) > 0:
258 - if (name + '_count') not in self.charts['commands_count']:
259 - self.add_command_dimensions(name)
260 - self.add_histogram_chart(cmd)
261 -
262 - to_netdata[name + '_count'] = cmd['count']
263 - to_netdata[name + '_duration'] = cmd['duration']
264 - for histogram in cmd['histogram']:
265 - dimId = 'commands_histogram_{0}_{1}'.format(name, histogram)
266 - to_netdata[dimId] = cmd['histogram'][histogram]
267 -
268 - return to_netdata or None
269 -
270 - def add_backend_dimensions(self, name):
271 - self.charts['pool_status'].add_dimension([name + '_status', name, 'absolute'])
272 - self.charts['pool_net'].add_dimension([name + '_bytes_data_recv', 'from_' + name, 'incremental', 8, 1024])
273 - self.charts['pool_net'].add_dimension([name + '_bytes_data_sent', 'to_' + name, 'incremental', -8, 1024])
274 - self.charts['pool_queries'].add_dimension([name + '_queries', name, 'incremental'])
275 - self.charts['pool_latency'].add_dimension([name + '_latency_us', name, 'absolute', 1, 1000])
276 - self.charts['pool_connection_used'].add_dimension([name + '_connused', name, 'absolute'])
277 - self.charts['pool_connection_free'].add_dimension([name + '_connfree', name, 'absolute'])
278 - self.charts['pool_connection_ok'].add_dimension([name + '_connok', name, 'incremental'])
279 - self.charts['pool_connection_error'].add_dimension([name + '_connerr', name, 'incremental'])
280 -
281 - def add_command_dimensions(self, cmd):
282 - self.charts['commands_count'].add_dimension([cmd + '_count', cmd, 'incremental'])
283 - self.charts['commands_duration'].add_dimension([cmd + '_duration', cmd, 'incremental', 1, 1000])
284 -
285 - def add_histogram_chart(self, cmd):
286 - chart = self.charts.add_chart(self.histogram_chart(cmd))
287 -
288 - for histogram in HISTOGRAM_ORDER:
289 - dimId = 'commands_histogram_{0}_{1}'.format(cmd['name'], histogram)
290 - chart.add_dimension([dimId, histogram, 'incremental'])
291 -
292 - @staticmethod
293 - def histogram_chart(cmd):
294 - return [
295 - 'commands_histogram_' + cmd['name'],
296 - None,
297 - 'ProxySQL {0} Command Histogram'.format(cmd['name'].title()),
298 - 'commands',
299 - 'commands_histogram',
300 - 'proxysql.commands_histogram_' + cmd['name'],
301 - 'stacked'
302 - ]
303 -
304 - @staticmethod
305 - def generate_backend(data):
306 - return {
307 - 'hostgroup': data[0],
308 - 'srv_host': data[1],
309 - 'srv_port': data[2],
310 - 'status': data[3],
311 - 'connused': data[4],
312 - 'connfree': data[5],
313 - 'connok': data[6],
314 - 'connerr': data[7],
315 - 'queries': data[8],
316 - 'bytes_data_sent': data[9],
317 - 'bytes_data_recv': data[10],
318 - 'latency_us': data[11]
319 - }
320 -
321 - @staticmethod
322 - def generate_command_stats(data):
323 - return {
324 - 'name': data[0].lower(),
325 - 'duration': data[1],
326 - 'count': data[2],
327 - 'histogram': {
328 - '100us': data[3],
329 - '500us': data[4],
330 - '1ms': data[5],
331 - '5ms': data[6],
332 - '10ms': data[7],
333 - '50ms': data[8],
334 - '100ms': data[9],
335 - '500ms': data[10],
336 - '1s': data[11],
337 - '5s': data[12],
338 - '10s': data[13],
339 - 'inf': data[14]
340 - }
341 - }
342 -
343 - @staticmethod
344 - def generate_backend_name(backend):
345 - hostgroup = backend['hostgroup'].replace(' ', '_').lower()
346 - host = backend['srv_host'].replace('.', '_')
347 -
348 - return "{0}_{1}_{2}".format(hostgroup, host, backend['srv_port'])
349 -
350 - @staticmethod
351 - def convert_status(status):
352 - if status in STATUS:
353 - return STATUS[status]
354 - return -1
collectors/python.d.plugin/proxysql/proxysql.conf deleted
-116
@@ -1,116 +0,0 @@
1 -# netdata python.d.plugin configuration for ProxySQL
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, proxysql also supports the following:
63 -#
64 -# host: 'IP or HOSTNAME' # the host to connect to
65 -# port: PORT # the port to connect to
66 -#
67 -# in all cases, the following can also be set:
68 -#
69 -# user: 'username' # the proxysql username to use
70 -# pass: 'password' # the proxysql password to use
71 -#
72 -
73 -# AUTO-DETECTION JOBS
74 -# only one of them will run (they have the same name)
75 -
76 -tcp:
77 - name : 'local'
78 - user : 'stats'
79 - pass : 'stats'
80 - host : 'localhost'
81 - port : '6032'
82 -
83 -tcpipv4:
84 - name : 'local'
85 - user : 'stats'
86 - pass : 'stats'
87 - host : '127.0.0.1'
88 - port : '6032'
89 -
90 -tcpipv6:
91 - name : 'local'
92 - user : 'stats'
93 - pass : 'stats'
94 - host : '::1'
95 - port : '6032'
96 -
97 -tcp_admin:
98 - name : 'local'
99 - user : 'admin'
100 - pass : 'admin'
101 - host : 'localhost'
102 - port : '6032'
103 -
104 -tcpipv4_admin:
105 - name : 'local'
106 - user : 'admin'
107 - pass : 'admin'
108 - host : '127.0.0.1'
109 - port : '6032'
110 -
111 -tcpipv6_admin:
112 - name : 'local'
113 - user : 'admin'
114 - pass : 'admin'
115 - host : '::1'
116 - port : '6032'
collectors/python.d.plugin/python.d.conf
-3
@@ -56,14 +56,11 @@ hpssa: no
56 # monit: yes
57 # nvidia_smi: yes
58 # nsd: yes
59 -# ntpd: yes
59 # openldap: yes
60 # oracledb: yes
61 # pandas: yes
62 # postfix: yes
64 -# proxysql: yes
63 # puppet: yes
66 -# rabbitmq: yes
64 # rethinkdbs: yes
65 # retroshare: yes
66 # riakkv: yes
collectors/python.d.plugin/rabbitmq/Makefile.inc deleted
-13
@@ -1,13 +0,0 @@
1 -# SPDX-License-Identifier: GPL-3.0-or-later
2 -
3 -# THIS IS NOT A COMPLETE Makefile
4 -# IT IS INCLUDED BY ITS PARENT'S Makefile.am
5 -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
6 -
7 -# install these files
8 -dist_python_DATA += rabbitmq/rabbitmq.chart.py
9 -dist_pythonconfig_DATA += rabbitmq/rabbitmq.conf
10 -
11 -# do not install these files, but include them in the distribution
12 -dist_noinst_DATA += rabbitmq/README.md rabbitmq/Makefile.inc
13 -
collectors/python.d.plugin/rabbitmq/README.md deleted
-141
@@ -1,141 +0,0 @@
1 -<!--
2 -title: "RabbitMQ monitoring with Netdata"
3 -custom_edit_url: "https://github.com/netdata/netdata/edit/master/collectors/python.d.plugin/rabbitmq/README.md"
4 -sidebar_label: "rabbitmq-python.d.plugin"
5 -learn_status: "Published"
6 -learn_topic_type: "References"
7 -learn_rel_path: "References/Collectors references/Message brokers"
8 --->
9 -
10 -# RabbitMQ monitoring with Netdata
11 -
12 -Collects message broker global and per virtual host metrics.
13 -
14 -
15 -Following charts are drawn:
16 -
17 -1. **Queued Messages**
18 -
19 - - ready
20 - - unacknowledged
21 -
22 -2. **Message Rates**
23 -
24 - - ack
25 - - redelivered
26 - - deliver
27 - - publish
28 -
29 -3. **Global Counts**
30 -
31 - - channels
32 - - consumers
33 - - connections
34 - - queues
35 - - exchanges
36 -
37 -4. **File Descriptors**
38 -
39 - - used descriptors
40 -
41 -5. **Socket Descriptors**
42 -
43 - - used descriptors
44 -
45 -6. **Erlang processes**
46 -
47 - - used processes
48 -
49 -7. **Erlang run queue**
50 -
51 - - Erlang run queue
52 -
53 -8. **Memory**
54 -
55 - - free memory in megabytes
56 -
57 -9. **Disk Space**
58 -
59 - - free disk space in gigabytes
60 -
61 -
62 -Per Vhost charts:
63 -
64 -1. **Vhost Messages**
65 -
66 - - ack
67 - - confirm
68 - - deliver
69 - - get
70 - - get_no_ack
71 - - publish
72 - - redeliver
73 - - return_unroutable
74 -
75 -2. Per Queue charts:
76 -
77 - 1. **Queued Messages**
78 -
79 - - messages
80 - - paged_out
81 - - persistent
82 - - ready
83 - - unacknowledged
84 -
85 - 2. **Queue Messages stats**
86 -
87 - - ack
88 - - confirm
89 - - deliver
90 - - get
91 - - get_no_ack
92 - - publish
93 - - redeliver
94 - - return_unroutable
95 -
96 -## Configuration
97 -
98 -Edit the `python.d/rabbitmq.conf` configuration file using `edit-config` from the Netdata [config
99 -directory](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md), which is typically at `/etc/netdata`.
100 -
101 -```bash
102 -cd /etc/netdata # Replace this path with your Netdata config directory, if different
103 -sudo ./edit-config python.d/rabbitmq.conf
104 -```
105 -
106 -When no configuration file is found, module tries to connect to: `localhost:15672`.
107 -
108 -```yaml
109 -socket:
110 - name : 'local'
111 - host : '127.0.0.1'
112 - port : 15672
113 - user : 'guest'
114 - pass : 'guest'
115 -```
116 -
117 ----
118 -
119 -### Per-Queue Chart configuration
120 -
121 -RabbitMQ users with the "monitoring" tag cannot see all queue data. You'll need a user with read permissions.
122 -To create a dedicated user for netdata:
123 -
124 -```bash
125 -rabbitmqctl add_user netdata ChangeThisSuperSecretPassword
126 -rabbitmqctl set_permissions netdata "^$" "^$" ".*"
127 -```
128 -
129 -See [set_permissions](https://www.rabbitmq.com/rabbitmqctl.8.html#set_permissions) for details.
130 -
131 -Once the user is set up, add `collect_queues_metrics: yes` to your `rabbitmq.conf`:
132 -
133 -```yaml
134 -local:
135 - name : 'local'
136 - host : '127.0.0.1'
137 - port : 15672
138 - user : 'netdata'
139 - pass : 'ChangeThisSuperSecretPassword'
140 - collect_queues_metrics : 'yes'
141 -```
collectors/python.d.plugin/rabbitmq/rabbitmq.chart.py deleted
-443
@@ -1,443 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: rabbitmq netdata python.d module
3 -# Author: ilyam8
4 -# SPDX-License-Identifier: GPL-3.0-or-later
5 -
6 -from json import loads
7 -
8 -from bases.FrameworkServices.UrlService import UrlService
9 -
10 -API_NODE = 'api/nodes'
11 -API_OVERVIEW = 'api/overview'
12 -API_QUEUES = 'api/queues'
13 -API_VHOSTS = 'api/vhosts'
14 -
15 -NODE_STATS = [
16 - 'fd_used',
17 - 'mem_used',
18 - 'sockets_used',
19 - 'proc_used',
20 - 'disk_free',
21 - 'run_queue'
22 -]
23 -
24 -OVERVIEW_STATS = [
25 - 'object_totals.channels',
26 - 'object_totals.consumers',
27 - 'object_totals.connections',
28 - 'object_totals.queues',
29 - 'object_totals.exchanges',
30 - 'queue_totals.messages_ready',
31 - 'queue_totals.messages_unacknowledged',
32 - 'message_stats.ack',
33 - 'message_stats.redeliver',
34 - 'message_stats.deliver',
35 - 'message_stats.publish',
36 - 'churn_rates.connection_created_details.rate',
37 - 'churn_rates.connection_closed_details.rate',
38 - 'churn_rates.channel_created_details.rate',
39 - 'churn_rates.channel_closed_details.rate',
40 - 'churn_rates.queue_created_details.rate',
41 - 'churn_rates.queue_declared_details.rate',
42 - 'churn_rates.queue_deleted_details.rate'
43 -]
44 -
45 -QUEUE_STATS = [
46 - 'messages',
47 - 'messages_paged_out',
48 - 'messages_persistent',
49 - 'messages_ready',
50 - 'messages_unacknowledged',
51 - 'message_stats.ack',
52 - 'message_stats.confirm',
53 - 'message_stats.deliver',
54 - 'message_stats.get',
55 - 'message_stats.get_no_ack',
56 - 'message_stats.publish',
57 - 'message_stats.redeliver',
58 - 'message_stats.return_unroutable',
59 -]
60 -
61 -VHOST_MESSAGE_STATS = [
62 - 'message_stats.ack',
63 - 'message_stats.confirm',
64 - 'message_stats.deliver',
65 - 'message_stats.get',
66 - 'message_stats.get_no_ack',
67 - 'message_stats.publish',
68 - 'message_stats.redeliver',
69 - 'message_stats.return_unroutable',
70 -]
71 -
72 -ORDER = [
73 - 'queued_messages',
74 - 'connection_churn_rates',
75 - 'channel_churn_rates',
76 - 'queue_churn_rates',
77 - 'message_rates',
78 - 'global_counts',
79 - 'file_descriptors',
80 - 'socket_descriptors',
81 - 'erlang_processes',
82 - 'erlang_run_queue',
83 - 'memory',
84 - 'disk_space'
85 -]
86 -
87 -CHARTS = {
88 - 'file_descriptors': {
89 - 'options': [None, 'File Descriptors', 'descriptors', 'overview', 'rabbitmq.file_descriptors', 'line'],
90 - 'lines': [
91 - ['fd_used', 'used', 'absolute']
92 - ]
93 - },
94 - 'memory': {
95 - 'options': [None, 'Memory', 'MiB', 'overview', 'rabbitmq.memory', 'area'],
96 - 'lines': [
97 - ['mem_used', 'used', 'absolute', 1, 1 << 20]
98 - ]
99 - },
100 - 'disk_space': {
101 - 'options': [None, 'Disk Space', 'GiB', 'overview', 'rabbitmq.disk_space', 'area'],
102 - 'lines': [
103 - ['disk_free', 'free', 'absolute', 1, 1 << 30]
104 - ]
105 - },
106 - 'socket_descriptors': {
107 - 'options': [None, 'Socket Descriptors', 'descriptors', 'overview', 'rabbitmq.sockets', 'line'],
108 - 'lines': [
109 - ['sockets_used', 'used', 'absolute']
110 - ]
111 - },
112 - 'erlang_processes': {
113 - 'options': [None, 'Erlang Processes', 'processes', 'overview', 'rabbitmq.processes', 'line'],
114 - 'lines': [
115 - ['proc_used', 'used', 'absolute']
116 - ]
117 - },
118 - 'erlang_run_queue': {
119 - 'options': [None, 'Erlang Run Queue', 'processes', 'overview', 'rabbitmq.erlang_run_queue', 'line'],
120 - 'lines': [
121 - ['run_queue', 'length', 'absolute']
122 - ]
123 - },
124 - 'global_counts': {
125 - 'options': [None, 'Global Counts', 'counts', 'overview', 'rabbitmq.global_counts', 'line'],
126 - 'lines': [
127 - ['object_totals_channels', 'channels', 'absolute'],
128 - ['object_totals_consumers', 'consumers', 'absolute'],
129 - ['object_totals_connections', 'connections', 'absolute'],
130 - ['object_totals_queues', 'queues', 'absolute'],
131 - ['object_totals_exchanges', 'exchanges', 'absolute']
132 - ]
133 - },
134 - 'connection_churn_rates': {
135 - 'options': [None, 'Connection Churn Rates', 'operations/s', 'overview', 'rabbitmq.connection_churn_rates', 'line'],
136 - 'lines': [
137 - ['churn_rates_connection_created_details_rate', 'created', 'absolute'],
138 - ['churn_rates_connection_closed_details_rate', 'closed', 'absolute']
139 - ]
140 - },
141 - 'channel_churn_rates': {
142 - 'options': [None, 'Channel Churn Rates', 'operations/s', 'overview', 'rabbitmq.channel_churn_rates', 'line'],
143 - 'lines': [
144 - ['churn_rates_channel_created_details_rate', 'created', 'absolute'],
145 - ['churn_rates_channel_closed_details_rate', 'closed', 'absolute']
146 - ]
147 - },
148 - 'queue_churn_rates': {
149 - 'options': [None, 'Queue Churn Rates', 'operations/s', 'overview', 'rabbitmq.queue_churn_rates', 'line'],
150 - 'lines': [
151 - ['churn_rates_queue_created_details_rate', 'created', 'absolute'],
152 - ['churn_rates_queue_declared_details_rate', 'declared', 'absolute'],
153 - ['churn_rates_queue_deleted_details_rate', 'deleted', 'absolute']
154 - ]
155 - },
156 - 'queued_messages': {
157 - 'options': [None, 'Queued Messages', 'messages', 'overview', 'rabbitmq.queued_messages', 'stacked'],
158 - 'lines': [
159 - ['queue_totals_messages_ready', 'ready', 'absolute'],
160 - ['queue_totals_messages_unacknowledged', 'unacknowledged', 'absolute']
161 - ]
162 - },
163 - 'message_rates': {
164 - 'options': [None, 'Message Rates', 'messages/s', 'overview', 'rabbitmq.message_rates', 'line'],
165 - 'lines': [
166 - ['message_stats_ack', 'ack', 'incremental'],
167 - ['message_stats_redeliver', 'redeliver', 'incremental'],
168 - ['message_stats_deliver', 'deliver', 'incremental'],
169 - ['message_stats_publish', 'publish', 'incremental']
170 - ]
171 - }
172 -}
173 -
174 -
175 -def vhost_chart_template(name):
176 - order = [
177 - 'vhost_{0}_message_stats'.format(name),
178 - ]
179 - family = 'vhost {0}'.format(name)
180 -
181 - charts = {
182 - order[0]: {
183 - 'options': [
184 - None, 'Vhost "{0}" Messages'.format(name), 'messages/s', family, 'rabbitmq.vhost_messages', 'stacked'],
185 - 'lines': [
186 - ['vhost_{0}_message_stats_ack'.format(name), 'ack', 'incremental'],
187 - ['vhost_{0}_message_stats_confirm'.format(name), 'confirm', 'incremental'],
188 - ['vhost_{0}_message_stats_deliver'.format(name), 'deliver', 'incremental'],
189 - ['vhost_{0}_message_stats_get'.format(name), 'get', 'incremental'],
190 - ['vhost_{0}_message_stats_get_no_ack'.format(name), 'get_no_ack', 'incremental'],
191 - ['vhost_{0}_message_stats_publish'.format(name), 'publish', 'incremental'],
192 - ['vhost_{0}_message_stats_redeliver'.format(name), 'redeliver', 'incremental'],
193 - ['vhost_{0}_message_stats_return_unroutable'.format(name), 'return_unroutable', 'incremental'],
194 - ]
195 - },
196 - }
197 -
198 - return order, charts
199 -
200 -def queue_chart_template(queue_id):
201 - vhost, name = queue_id
202 - order = [
203 - 'vhost_{0}_queue_{1}_queued_message'.format(vhost, name),
204 - 'vhost_{0}_queue_{1}_messages_stats'.format(vhost, name),
205 - ]
206 - family = 'vhost {0}'.format(vhost)
207 -
208 - charts = {
209 - order[0]: {
210 - 'options': [
211 - None, 'Queue "{0}" in "{1}" queued messages'.format(name, vhost), 'messages', family, 'rabbitmq.queue_messages', 'line'],
212 - 'lines': [
213 - ['vhost_{0}_queue_{1}_messages'.format(vhost, name), 'messages', 'absolute'],
214 - ['vhost_{0}_queue_{1}_messages_paged_out'.format(vhost, name), 'paged_out', 'absolute'],
215 - ['vhost_{0}_queue_{1}_messages_persistent'.format(vhost, name), 'persistent', 'absolute'],
216 - ['vhost_{0}_queue_{1}_messages_ready'.format(vhost, name), 'ready', 'absolute'],
217 - ['vhost_{0}_queue_{1}_messages_unacknowledged'.format(vhost, name), 'unack', 'absolute'],
218 - ]
219 - },
220 - order[1]: {
221 - 'options': [
222 - None, 'Queue "{0}" in "{1}" messages stats'.format(name, vhost), 'messages/s', family, 'rabbitmq.queue_messages_stats', 'line'],
223 - 'lines': [
224 - ['vhost_{0}_queue_{1}_message_stats_ack'.format(vhost, name), 'ack', 'incremental'],
225 - ['vhost_{0}_queue_{1}_message_stats_confirm'.format(vhost, name), 'confirm', 'incremental'],
226 - ['vhost_{0}_queue_{1}_message_stats_deliver'.format(vhost, name), 'deliver', 'incremental'],
227 - ['vhost_{0}_queue_{1}_message_stats_get'.format(vhost, name), 'get', 'incremental'],
228 - ['vhost_{0}_queue_{1}_message_stats_get_no_ack'.format(vhost, name), 'get_no_ack', 'incremental'],
229 - ['vhost_{0}_queue_{1}_message_stats_publish'.format(vhost, name), 'publish', 'incremental'],
230 - ['vhost_{0}_queue_{1}_message_stats_redeliver'.format(vhost, name), 'redeliver', 'incremental'],
231 - ['vhost_{0}_queue_{1}_message_stats_return_unroutable'.format(vhost, name), 'return_unroutable', 'incremental'],
232 - ]
233 - },
234 - }
235 -
236 - return order, charts
237 -
238 -
239 -class VhostStatsBuilder:
240 - def __init__(self):
241 - self.stats = None
242 -
243 - def set(self, raw_stats):
244 - self.stats = raw_stats
245 -
246 - def name(self):
247 - return self.stats['name']
248 -
249 - def has_msg_stats(self):
250 - return bool(self.stats.get('message_stats'))
251 -
252 - def msg_stats(self):
253 - name = self.name()
254 - stats = fetch_data(raw_data=self.stats, metrics=VHOST_MESSAGE_STATS)
255 - return dict(('vhost_{0}_{1}'.format(name, k), v) for k, v in stats.items())
256 -
257 -class QueueStatsBuilder:
258 - def __init__(self):
259 - self.stats = None
260 -
261 - def set(self, raw_stats):
262 - self.stats = raw_stats
263 -
264 - def id(self):
265 - return self.stats['vhost'], self.stats['name']
266 -
267 - def queue_stats(self):
268 - vhost, name = self.id()
269 - stats = fetch_data(raw_data=self.stats, metrics=QUEUE_STATS)
270 - return dict(('vhost_{0}_queue_{1}_{2}'.format(vhost, name, k), v) for k, v in stats.items())
271 -
272 -
273 -class Service(UrlService):
274 - def __init__(self, configuration=None, name=None):
275 - UrlService.__init__(self, configuration=configuration, name=name)
276 - self.order = ORDER
277 - self.definitions = CHARTS
278 - self.url = '{0}://{1}:{2}'.format(
279 - configuration.get('scheme', 'http'),
280 - configuration.get('host', '127.0.0.1'),
281 - configuration.get('port', 15672),
282 - )
283 - self.node_name = str()
284 - self.vhost = VhostStatsBuilder()
285 - self.collected_vhosts = set()
286 - self.collect_queues_metrics = configuration.get('collect_queues_metrics', False)
287 - self.debug("collect_queues_metrics is {0}".format("enabled" if self.collect_queues_metrics else "disabled"))
288 - if self.collect_queues_metrics:
289 - self.queue = QueueStatsBuilder()
290 - self.collected_queues = set()
291 -
292 - def _get_data(self):
293 - data = dict()
294 -
295 - stats = self.get_overview_stats()
296 - if not stats:
297 - return None
298 -
299 - data.update(stats)
300 -
301 - stats = self.get_nodes_stats()
302 - if not stats:
303 - return None
304 -
305 - data.update(stats)
306 -
307 - stats = self.get_vhosts_stats()
308 - if stats:
309 - data.update(stats)
310 -
311 - if self.collect_queues_metrics:
312 - stats = self.get_queues_stats()
313 - if stats:
314 - data.update(stats)
315 -
316 - return data or None
317 -
318 - def get_overview_stats(self):
319 - url = '{0}/{1}'.format(self.url, API_OVERVIEW)
320 - self.debug("doing http request to '{0}'".format(url))
321 - raw = self._get_raw_data(url)
322 - if not raw:
323 - return None
324 -
325 - data = loads(raw)
326 - self.node_name = data['node']
327 - self.debug("found node name: '{0}'".format(self.node_name))
328 -
329 - stats = fetch_data(raw_data=data, metrics=OVERVIEW_STATS)
330 - self.debug("number of metrics: {0}".format(len(stats)))
331 - return stats
332 -
333 - def get_nodes_stats(self):
334 - if self.node_name == "":
335 - self.error("trying to get node stats, but node name is not set")
336 - return None
337 -
338 - url = '{0}/{1}/{2}'.format(self.url, API_NODE, self.node_name)
339 - self.debug("doing http request to '{0}'".format(url))
340 - raw = self._get_raw_data(url)
341 - if not raw:
342 - return None
343 -
344 - data = loads(raw)
345 - stats = fetch_data(raw_data=data, metrics=NODE_STATS)
346 - handle_disabled_disk_monitoring(stats)
347 - self.debug("number of metrics: {0}".format(len(stats)))
348 - return stats
349 -
350 - def get_vhosts_stats(self):
351 - url = '{0}/{1}'.format(self.url, API_VHOSTS)
352 - self.debug("doing http request to '{0}'".format(url))
353 - raw = self._get_raw_data(url)
354 - if not raw:
355 - return None
356 -
357 - data = dict()
358 - vhosts = loads(raw)
359 - charts_initialized = len(self.charts) > 0
360 -
361 - for vhost in vhosts:
362 - self.vhost.set(vhost)
363 - if not self.vhost.has_msg_stats():
364 - continue
365 -
366 - if charts_initialized and self.vhost.name() not in self.collected_vhosts:
367 - self.collected_vhosts.add(self.vhost.name())
368 - self.add_vhost_charts(self.vhost.name())
369 -
370 - data.update(self.vhost.msg_stats())
371 -
372 - self.debug("number of vhosts: {0}, metrics: {1}".format(len(vhosts), len(data)))
373 - return data
374 -
375 - def get_queues_stats(self):
376 - url = '{0}/{1}'.format(self.url, API_QUEUES)
377 - self.debug("doing http request to '{0}'".format(url))
378 - raw = self._get_raw_data(url)
379 - if not raw:
380 - return None
381 -
382 - data = dict()
383 - queues = loads(raw)
384 - charts_initialized = len(self.charts) > 0
385 -
386 - for queue in queues:
387 - self.queue.set(queue)
388 - if self.queue.id()[0] not in self.collected_vhosts:
389 - continue
390 -
391 - if charts_initialized and self.queue.id() not in self.collected_queues:
392 - self.collected_queues.add(self.queue.id())
393 - self.add_queue_charts(self.queue.id())
394 -
395 - data.update(self.queue.queue_stats())
396 -
397 - self.debug("number of queues: {0}, metrics: {1}".format(len(queues), len(data)))
398 - return data
399 -
400 - def add_vhost_charts(self, vhost_name):
401 - order, charts = vhost_chart_template(vhost_name)
402 -
403 - for chart_name in order:
404 - params = [chart_name] + charts[chart_name]['options']
405 - dimensions = charts[chart_name]['lines']
406 -
407 - new_chart = self.charts.add_chart(params)
408 - for dimension in dimensions:
409 - new_chart.add_dimension(dimension)
410 -
411 - def add_queue_charts(self, queue_id):
412 - order, charts = queue_chart_template(queue_id)
413 -
414 - for chart_name in order:
415 - params = [chart_name] + charts[chart_name]['options']
416 - dimensions = charts[chart_name]['lines']
417 -
418 - new_chart = self.charts.add_chart(params)
419 - for dimension in dimensions:
420 - new_chart.add_dimension(dimension)
421 -
422 -
423 -def fetch_data(raw_data, metrics):
424 - data = dict()
425 - for metric in metrics:
426 - value = raw_data
427 - metrics_list = metric.split('.')
428 - try:
429 - for m in metrics_list:
430 - value = value[m]
431 - except (KeyError, TypeError):
432 - continue
433 - data['_'.join(metrics_list)] = value
434 -
435 - return data
436 -
437 -
438 -def handle_disabled_disk_monitoring(node_stats):
439 - # https://github.com/netdata/netdata/issues/7218
440 - # can be "disk_free": "disk_free_monitoring_disabled"
441 - v = node_stats.get('disk_free')
442 - if v and not isinstance(v, int):
443 - del node_stats['disk_free']
collectors/python.d.plugin/rabbitmq/rabbitmq.conf deleted
-86
@@ -1,86 +0,0 @@
1 -# netdata python.d.plugin configuration for rabbitmq
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, rabbitmq plugin also supports the following:
63 -#
64 -# host: 'ipaddress' # Server ip address or hostname. Default: 127.0.0.1
65 -# port: 'port' # Rabbitmq port. Default: 15672
66 -# scheme: 'scheme' # http or https. Default: http
67 -#
68 -# if the URL is password protected, the following are supported:
69 -#
70 -# user: 'username'
71 -# pass: 'password'
72 -#
73 -# Rabbitmq plugin can also collect stats per vhost per queues, which is disabled
74 -# by default. Please note that enabling this can induced a serious overhead on
75 -# both netdata and rabbitmq if a look of queues are configured and used.
76 -#
77 -# collect_queues_metrics: 'yes/no'
78 -#
79 -# ----------------------------------------------------------------------
80 -# AUTO-DETECTION JOBS
81 -# only one of them will run (they have the same name)
82 -#
83 -local:
84 - host: '127.0.0.1'
85 - user: 'guest'
86 - pass: 'guest'