diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /python.d/python_modules | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/charts.d.plugin/apcupsd/README.md (renamed from python.d/python_modules/bases/FrameworkServices/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/charts.d.plugin/opensips/README.md (renamed from python.d/python_modules/bases/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/__init__.py (renamed from python.d/python_modules/third_party/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/ExecutableService.py (renamed from python.d/python_modules/bases/FrameworkServices/ExecutableService.py) | 9 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py (renamed from python.d/python_modules/bases/FrameworkServices/LogService.py) | 2 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py (renamed from python.d/python_modules/bases/FrameworkServices/MySQLService.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py (renamed from python.d/python_modules/bases/FrameworkServices/SimpleService.py) | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py (renamed from python.d/python_modules/bases/FrameworkServices/SocketService.py) | 64 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py (renamed from python.d/python_modules/bases/FrameworkServices/UrlService.py) | 32 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/FrameworkServices/__init__.py (renamed from python.d/python_modules/urllib3/contrib/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/__init__.py (renamed from python.d/python_modules/urllib3/contrib/_securetransport/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/charts.py (renamed from python.d/python_modules/bases/charts.py) | 18 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/collection.py (renamed from python.d/python_modules/bases/collection.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/loaders.py (renamed from python.d/python_modules/bases/loaders.py) | 21 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/bases/loggers.py (renamed from python.d/python_modules/bases/loggers.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/__init__.py (renamed from python.d/python_modules/pyyaml2/__init__.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/composer.py (renamed from python.d/python_modules/pyyaml2/composer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/constructor.py (renamed from python.d/python_modules/pyyaml2/constructor.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/cyaml.py (renamed from python.d/python_modules/pyyaml2/cyaml.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/dumper.py (renamed from python.d/python_modules/pyyaml2/dumper.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/emitter.py (renamed from python.d/python_modules/pyyaml2/emitter.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/error.py (renamed from python.d/python_modules/pyyaml2/error.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/events.py (renamed from python.d/python_modules/pyyaml2/events.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/loader.py (renamed from python.d/python_modules/pyyaml2/loader.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/nodes.py (renamed from python.d/python_modules/pyyaml2/nodes.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/parser.py (renamed from python.d/python_modules/pyyaml2/parser.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/reader.py (renamed from python.d/python_modules/pyyaml2/reader.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/representer.py (renamed from python.d/python_modules/pyyaml2/representer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/resolver.py (renamed from python.d/python_modules/pyyaml2/resolver.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/scanner.py (renamed from python.d/python_modules/pyyaml2/scanner.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/serializer.py (renamed from python.d/python_modules/pyyaml2/serializer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml2/tokens.py (renamed from python.d/python_modules/pyyaml2/tokens.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/__init__.py (renamed from python.d/python_modules/pyyaml3/__init__.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/composer.py (renamed from python.d/python_modules/pyyaml3/composer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/constructor.py (renamed from python.d/python_modules/pyyaml3/constructor.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/cyaml.py (renamed from python.d/python_modules/pyyaml3/cyaml.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/dumper.py (renamed from python.d/python_modules/pyyaml3/dumper.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/emitter.py (renamed from python.d/python_modules/pyyaml3/emitter.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/error.py (renamed from python.d/python_modules/pyyaml3/error.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/events.py (renamed from python.d/python_modules/pyyaml3/events.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/loader.py (renamed from python.d/python_modules/pyyaml3/loader.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/nodes.py (renamed from python.d/python_modules/pyyaml3/nodes.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/parser.py (renamed from python.d/python_modules/pyyaml3/parser.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/reader.py (renamed from python.d/python_modules/pyyaml3/reader.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/representer.py (renamed from python.d/python_modules/pyyaml3/representer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/resolver.py (renamed from python.d/python_modules/pyyaml3/resolver.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/scanner.py (renamed from python.d/python_modules/pyyaml3/scanner.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/serializer.py (renamed from python.d/python_modules/pyyaml3/serializer.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/pyyaml3/tokens.py (renamed from python.d/python_modules/pyyaml3/tokens.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/third_party/__init__.py (renamed from python.d/python_modules/urllib3/packages/backports/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/third_party/lm_sensors.py (renamed from python.d/python_modules/third_party/lm_sensors.py) | 3 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/third_party/ordereddict.py (renamed from python.d/python_modules/third_party/ordereddict.py) | 20 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/__init__.py (renamed from python.d/python_modules/urllib3/__init__.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/_collections.py (renamed from python.d/python_modules/urllib3/_collections.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/connection.py (renamed from python.d/python_modules/urllib3/connection.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/connectionpool.py (renamed from python.d/python_modules/urllib3/connectionpool.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/bindings.py (renamed from python.d/python_modules/urllib3/contrib/_securetransport/bindings.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/low_level.py (renamed from python.d/python_modules/urllib3/contrib/_securetransport/low_level.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/appengine.py (renamed from python.d/python_modules/urllib3/contrib/appengine.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/ntlmpool.py (renamed from python.d/python_modules/urllib3/contrib/ntlmpool.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/pyopenssl.py (renamed from python.d/python_modules/urllib3/contrib/pyopenssl.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/securetransport.py (renamed from python.d/python_modules/urllib3/contrib/securetransport.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/contrib/socks.py (renamed from python.d/python_modules/urllib3/contrib/socks.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/exceptions.py (renamed from python.d/python_modules/urllib3/exceptions.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/fields.py (renamed from python.d/python_modules/urllib3/fields.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/filepost.py (renamed from python.d/python_modules/urllib3/filepost.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/__init__.py (renamed from python.d/python_modules/urllib3/packages/__init__.py) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/backports/makefile.py (renamed from python.d/python_modules/urllib3/packages/backports/makefile.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/ordered_dict.py (renamed from python.d/python_modules/urllib3/packages/ordered_dict.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/six.py (renamed from python.d/python_modules/urllib3/packages/six.py) | 18 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/__init__.py (renamed from python.d/python_modules/urllib3/packages/ssl_match_hostname/__init__.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py (renamed from python.d/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py) | 3 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/poolmanager.py (renamed from python.d/python_modules/urllib3/poolmanager.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/request.py (renamed from python.d/python_modules/urllib3/request.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/response.py (renamed from python.d/python_modules/urllib3/response.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/__init__.py (renamed from python.d/python_modules/urllib3/util/__init__.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/connection.py (renamed from python.d/python_modules/urllib3/util/connection.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/request.py (renamed from python.d/python_modules/urllib3/util/request.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/response.py (renamed from python.d/python_modules/urllib3/util/response.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/retry.py (renamed from python.d/python_modules/urllib3/util/retry.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/selectors.py (renamed from python.d/python_modules/urllib3/util/selectors.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/ssl_.py (renamed from python.d/python_modules/urllib3/util/ssl_.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/timeout.py (renamed from python.d/python_modules/urllib3/util/timeout.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/url.py (renamed from python.d/python_modules/urllib3/util/url.py) | 1 | ||||
-rw-r--r-- | collectors/python.d.plugin/python_modules/urllib3/util/wait.py (renamed from python.d/python_modules/urllib3/util/wait.py) | 1 | ||||
-rw-r--r-- | python.d/python_modules/__init__.py | 1 | ||||
-rw-r--r-- | python.d/python_modules/base.py | 9 |
87 files changed, 201 insertions, 79 deletions
diff --git a/python.d/python_modules/bases/FrameworkServices/__init__.py b/collectors/charts.d.plugin/apcupsd/README.md index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/bases/FrameworkServices/__init__.py +++ b/collectors/charts.d.plugin/apcupsd/README.md diff --git a/python.d/python_modules/bases/__init__.py b/collectors/charts.d.plugin/opensips/README.md index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/bases/__init__.py +++ b/collectors/charts.d.plugin/opensips/README.md diff --git a/python.d/python_modules/third_party/__init__.py b/collectors/python.d.plugin/python_modules/__init__.py index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/third_party/__init__.py +++ b/collectors/python.d.plugin/python_modules/__init__.py diff --git a/python.d/python_modules/bases/FrameworkServices/ExecutableService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/ExecutableService.py index a71f2bfd2..72f9ff714 100644 --- a/python.d/python_modules/bases/FrameworkServices/ExecutableService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/ExecutableService.py @@ -2,6 +2,7 @@ # Description: # Author: Pawel Krupa (paulfantom) # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import os @@ -16,15 +17,15 @@ class ExecutableService(SimpleService): SimpleService.__init__(self, configuration=configuration, name=name) self.command = None - def _get_raw_data(self, stderr=False): + def _get_raw_data(self, stderr=False, command=None): """ Get raw data from executed command :return: <list> """ try: - p = Popen(self.command, stdout=PIPE, stderr=PIPE) + p = Popen(command if command else self.command, stdout=PIPE, stderr=PIPE) except Exception as error: - self.error('Executing command {command} resulted in error: {error}'.format(command=self.command, + self.error('Executing command {command} resulted in error: {error}'.format(command=command or self.command, error=error)) return None data = list() @@ -35,7 +36,7 @@ class ExecutableService(SimpleService): except TypeError: continue - return data or None + return data def check(self): """ diff --git a/python.d/python_modules/bases/FrameworkServices/LogService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py index 45daa2446..5acfd73f8 100644 --- a/python.d/python_modules/bases/FrameworkServices/LogService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/LogService.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # Description: # Author: Pawel Krupa (paulfantom) +# Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later from glob import glob import os diff --git a/python.d/python_modules/bases/FrameworkServices/MySQLService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py index 3acc5b109..53807e2c4 100644 --- a/python.d/python_modules/bases/FrameworkServices/MySQLService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/MySQLService.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later from sys import exc_info diff --git a/python.d/python_modules/bases/FrameworkServices/SimpleService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py index 177332c1f..dd53fbc14 100644 --- a/python.d/python_modules/bases/FrameworkServices/SimpleService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py @@ -2,13 +2,12 @@ # Description: # Author: Pawel Krupa (paulfantom) # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later from threading import Thread +from time import sleep -try: - from time import sleep, monotonic as time -except ImportError: - from time import sleep, time +from third_party.monotonic import monotonic from bases.charts import Charts, ChartError, create_runtime_chart from bases.collection import OldVersionCompatibility, safe_print @@ -168,7 +167,7 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec 'retries: {retries}'.format(freq=job.FREQ, retries=job.RETRIES_MAX - job.RETRIES)) while True: - job.START_RUN = time() + job.START_RUN = monotonic() job.NEXT_RUN = job.START_RUN - (job.START_RUN % job.FREQ) + job.FREQ + job.PENALTY @@ -189,7 +188,7 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec if not self.manage_retries(): return else: - job.ELAPSED = int((time() - job.START_RUN) * 1e3) + job.ELAPSED = int((monotonic() - job.START_RUN) * 1e3) job.PREV_UPDATE = job.START_RUN job.RETRIES, job.PENALTY = 0, 0 safe_print(RUNTIME_CHART_UPDATE.format(job_name=self.name, @@ -253,7 +252,7 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec self.debug('sleeping for {sleep_time} to reach frequency of {freq} sec'.format(sleep_time=sleep_time, freq=job.FREQ + job.PENALTY)) sleep(sleep_time) - job.START_RUN = time() + job.START_RUN = monotonic() def get_data(self): return self._get_data() diff --git a/python.d/python_modules/bases/FrameworkServices/SocketService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py index 8d27ae660..e85455307 100644 --- a/python.d/python_modules/bases/FrameworkServices/SocketService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SocketService.py @@ -1,9 +1,18 @@ # -*- coding: utf-8 -*- # Description: # Author: Pawel Krupa (paulfantom) +# Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import socket +try: + import ssl +except ImportError: + _TLS_SUPPORT = False +else: + _TLS_SUPPORT = True + from bases.FrameworkServices.SimpleService import SimpleService @@ -16,6 +25,9 @@ class SocketService(SimpleService): self.unix_socket = None self.dgram_socket = False self.request = '' + self.tls = False + self.cert = None + self.key = None self.__socket_config = None self.__empty_request = "".encode() SimpleService.__init__(self, configuration=configuration, name=name) @@ -26,7 +38,7 @@ class SocketService(SimpleService): message=message)) else: if self.__socket_config is not None: - af, sock_type, proto, canon_name, sa = self.__socket_config + _, _, _, _, sa = self.__socket_config self.error('socket to "{address}" port {port}: {message}'.format(address=sa[0], port=sa[1], message=message)) @@ -44,7 +56,7 @@ class SocketService(SimpleService): self.error("Cannot create socket to 'None':") return False - af, sock_type, proto, canon_name, sa = res + af, sock_type, proto, _, sa = res try: self.debug('Creating socket to "{address}", port {port}'.format(address=sa[0], port=sa[1])) self._sock = socket.socket(af, sock_type, proto) @@ -56,10 +68,24 @@ class SocketService(SimpleService): self.__socket_config = None return False + if self.tls: + try: + self.debug('Encapsulating socket with TLS') + self._sock = ssl.wrap_socket(self._sock, + keyfile=self.key, + certfile=self.cert, + server_side=False, + cert_reqs=ssl.CERT_NONE) + except (socket.error, ssl.SSLError) as error: + self.error('Failed to wrap socket.') + self._disconnect() + self.__socket_config = None + return False + try: self.debug('connecting socket to "{address}", port {port}'.format(address=sa[0], port=sa[1])) self._sock.connect(sa) - except socket.error as error: + except (socket.error, ssl.SSLError) as error: self.error('Failed to connect to "{address}", port {port}, error: {error}'.format(address=sa[0], port=sa[1], error=error)) @@ -147,7 +173,7 @@ class SocketService(SimpleService): pass self._sock = None - def _send(self): + def _send(self, request=None): """ Send request. :return: boolean @@ -155,8 +181,8 @@ class SocketService(SimpleService): # Send request if it is needed if self.request != self.__empty_request: try: - self.debug('sending request: {0}'.format(self.request)) - self._sock.send(self.request) + self.debug('sending request: {0}'.format(request or self.request)) + self._sock.send(request or self.request) except Exception as error: self._socket_error('error sending request: {0}'.format(error)) self._disconnect() @@ -197,7 +223,7 @@ class SocketService(SimpleService): self.debug('final response: {0}'.format(data)) return data - def _get_raw_data(self, raw=False): + def _get_raw_data(self, raw=False, request=None): """ Get raw data with low-level "socket" module. :param raw: set `True` to return bytes @@ -211,7 +237,7 @@ class SocketService(SimpleService): return None # Send request if it is needed - if not self._send(): + if not self._send(request): return None data = self._receive(raw) @@ -249,6 +275,28 @@ class SocketService(SimpleService): except (KeyError, TypeError): self.debug('No port specified. Using: "{0}"'.format(self.port)) + self.tls = bool(self.configuration.get('tls', self.tls)) + if self.tls and not _TLS_SUPPORT: + self.warning('TLS requested but no TLS module found, disabling TLS support.') + self.tls = False + if _TLS_SUPPORT and not self.tls: + self.debug('No TLS preference specified, not using TLS.') + + if self.tls and _TLS_SUPPORT: + self.key = self.configuration.get('tls_key_file') + self.cert = self.configuration.get('tls_cert_file') + if not self.cert: + # If there's not a valid certificate, clear the key too. + self.debug('No valid TLS client certificate configuration found.') + self.key = None + self.cert = None + elif not self.key: + # If a key isn't listed, the config may still be + # valid, because there may be a key attached to the + # certificate. + self.info('No TLS client key specified, assuming it\'s attached to the certificate.') + self.key = None + try: self.request = str(self.configuration['request']) except (KeyError, TypeError): diff --git a/python.d/python_modules/bases/FrameworkServices/UrlService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py index bb340ba3b..856f38851 100644 --- a/python.d/python_modules/bases/FrameworkServices/UrlService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/UrlService.py @@ -2,6 +2,7 @@ # Description: # Author: Pawel Krupa (paulfantom) # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import urllib3 @@ -22,8 +23,13 @@ class UrlService(SimpleService): self.proxy_user = self.configuration.get('proxy_user') self.proxy_password = self.configuration.get('proxy_pass') self.proxy_url = self.configuration.get('proxy_url') + self.method = self.configuration.get('method', 'GET') self.header = self.configuration.get('header') self.request_timeout = self.configuration.get('timeout', 1) + self.tls_verify = self.configuration.get('tls_verify') + self.tls_ca_file = self.configuration.get('tls_ca_file') + self.tls_key_file = self.configuration.get('tls_key_file') + self.tls_cert_file = self.configuration.get('tls_cert_file') self._manager = None def __make_headers(self, **header_kw): @@ -60,9 +66,21 @@ class UrlService(SimpleService): else: manager = urllib3.PoolManager params = dict(headers=header) + tls_cert_file = self.tls_cert_file + if tls_cert_file: + params['cert_file'] = tls_cert_file + # NOTE: key_file is useless without cert_file, but + # cert_file may include the key as well. + tls_key_file = self.tls_key_file + if tls_key_file: + params['key_file'] = tls_key_file + tls_ca_file = self.tls_ca_file + if tls_ca_file: + params['ca_certs'] = tls_ca_file try: url = header_kw.get('url') or self.url - if url.startswith('https'): + if url.startswith('https') and not self.tls_verify and not tls_ca_file: + params['ca_certs'] = None return manager(assert_hostname=False, cert_reqs='CERT_NONE', **params) return manager(**params) except (urllib3.exceptions.ProxySchemeUnknown, TypeError) as error: @@ -77,13 +95,13 @@ class UrlService(SimpleService): try: status, data = self._get_raw_data_with_status(url, manager) except (urllib3.exceptions.HTTPError, TypeError, AttributeError) as error: - self.error('Url: {url}. Error: {error}'.format(url=url, error=error)) + self.error('Url: {url}. Error: {error}'.format(url=url or self.url, error=error)) return None if status == 200: - return data.decode() + return data else: - self.debug('Url: {url}. Http response status code: {code}'.format(url=url, code=status)) + self.debug('Url: {url}. Http response status code: {code}'.format(url=url or self.url, code=status)) return None def _get_raw_data_with_status(self, url=None, manager=None, retries=1, redirect=True): @@ -93,13 +111,15 @@ class UrlService(SimpleService): """ url = url or self.url manager = manager or self._manager - response = manager.request(method='GET', + response = manager.request(method=self.method, url=url, timeout=self.request_timeout, retries=retries, headers=manager.headers, redirect=redirect) - return response.status, response.data + if isinstance(response.data, str): + return response.status, response.data + return response.status, response.data.decode() def check(self): """ diff --git a/python.d/python_modules/urllib3/contrib/__init__.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/__init__.py index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/urllib3/contrib/__init__.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/__init__.py diff --git a/python.d/python_modules/urllib3/contrib/_securetransport/__init__.py b/collectors/python.d.plugin/python_modules/bases/__init__.py index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/urllib3/contrib/_securetransport/__init__.py +++ b/collectors/python.d.plugin/python_modules/bases/__init__.py diff --git a/python.d/python_modules/bases/charts.py b/collectors/python.d.plugin/python_modules/bases/charts.py index 5394fbf64..2963739ec 100644 --- a/python.d/python_modules/bases/charts.py +++ b/collectors/python.d.plugin/python_modules/bases/charts.py @@ -1,10 +1,11 @@ # -*- coding: utf-8 -*- # Description: # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later from bases.collection import safe_print -CHART_PARAMS = ['type', 'id', 'name', 'title', 'units', 'family', 'context', 'chart_type'] +CHART_PARAMS = ['type', 'id', 'name', 'title', 'units', 'family', 'context', 'chart_type', 'hidden'] DIMENSION_PARAMS = ['id', 'name', 'algorithm', 'multiplier', 'divisor', 'hidden'] VARIABLE_PARAMS = ['id', 'value'] @@ -13,9 +14,9 @@ DIMENSION_ALGORITHMS = ['absolute', 'incremental', 'percentage-of-absolute-row', CHART_BEGIN = 'BEGIN {type}.{id} {since_last}\n' CHART_CREATE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \ - "{chart_type} {priority} {update_every} '' 'python.d.plugin' '{module_name}'\n" + "{chart_type} {priority} {update_every} '{hidden}' 'python.d.plugin' '{module_name}'\n" CHART_OBSOLETE = "CHART {type}.{id} '{name}' '{title}' '{units}' '{family}' '{context}' " \ - "{chart_type} {priority} {update_every} 'obsolete'\n" + "{chart_type} {priority} {update_every} '{hidden} obsolete'\n" DIMENSION_CREATE = "DIMENSION '{id}' '{name}' {algorithm} {multiplier} {divisor} '{hidden}'\n" @@ -151,6 +152,8 @@ class Chart: id=self.params['id']) if self.params.get('chart_type') not in CHART_TYPES: self.params['chart_type'] = 'absolute' + hidden = str(self.params.get('hidden', '')) + self.params['hidden'] = 'hidden' if hidden == 'hidden' else '' self.dimensions = list() self.variables = set() @@ -304,6 +307,12 @@ class Dimension: return self.id == other return self.id == other.id + def __ne__(self, other): + return not self == other + + def __hash__(self): + return hash(repr(self)) + def create(self): return DIMENSION_CREATE.format(**self.params) @@ -360,6 +369,9 @@ class ChartVariable: return self.id == other.id return False + def __ne__(self, other): + return not self == other + def __hash__(self): return hash(repr(self)) diff --git a/python.d/python_modules/bases/collection.py b/collectors/python.d.plugin/python_modules/bases/collection.py index e03b4f58e..479a3b610 100644 --- a/python.d/python_modules/bases/collection.py +++ b/collectors/python.d.plugin/python_modules/bases/collection.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import os diff --git a/python.d/python_modules/bases/loaders.py b/collectors/python.d.plugin/python_modules/bases/loaders.py index d18b9dcd0..9eb268ce7 100644 --- a/python.d/python_modules/bases/loaders.py +++ b/collectors/python.d.plugin/python_modules/bases/loaders.py @@ -1,18 +1,27 @@ # -*- coding: utf-8 -*- # Description: # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import types + from sys import version_info PY_VERSION = version_info[:2] +try: + if PY_VERSION > (3, 1): + from pyyaml3 import SafeLoader as YamlSafeLoader + else: + from pyyaml2 import SafeLoader as YamlSafeLoader +except ImportError: + from yaml import SafeLoader as YamlSafeLoader + + if PY_VERSION > (3, 1): - from pyyaml3 import SafeLoader as YamlSafeLoader from importlib.machinery import SourceFileLoader DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' else: - from pyyaml2 import SafeLoader as YamlSafeLoader from imp import load_source as SourceFileLoader DEFAULT_MAPPING_TAG = u'tag:yaml.org,2002:map' @@ -26,6 +35,14 @@ def dict_constructor(loader, node): return OrderedDict(loader.construct_pairs(node)) +def safe_load(stream): + loader = YamlSafeLoader(stream) + try: + return loader.get_single_data() + finally: + loader.dispose() + + YamlSafeLoader.add_constructor(DEFAULT_MAPPING_TAG, dict_constructor) diff --git a/python.d/python_modules/bases/loggers.py b/collectors/python.d.plugin/python_modules/bases/loggers.py index fc40b83d3..39be77a79 100644 --- a/python.d/python_modules/bases/loggers.py +++ b/collectors/python.d.plugin/python_modules/bases/loggers.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import logging import traceback diff --git a/python.d/python_modules/pyyaml2/__init__.py b/collectors/python.d.plugin/python_modules/pyyaml2/__init__.py index 76e19e13f..4d560e438 100644 --- a/python.d/python_modules/pyyaml2/__init__.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from error import * diff --git a/python.d/python_modules/pyyaml2/composer.py b/collectors/python.d.plugin/python_modules/pyyaml2/composer.py index 06e5ac782..6b41b8067 100644 --- a/python.d/python_modules/pyyaml2/composer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/composer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Composer', 'ComposerError'] diff --git a/python.d/python_modules/pyyaml2/constructor.py b/collectors/python.d.plugin/python_modules/pyyaml2/constructor.py index 635faac3e..8ad1b90a7 100644 --- a/python.d/python_modules/pyyaml2/constructor.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/constructor.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor', 'ConstructorError'] diff --git a/python.d/python_modules/pyyaml2/cyaml.py b/collectors/python.d.plugin/python_modules/pyyaml2/cyaml.py index 68dcd7519..2858ab479 100644 --- a/python.d/python_modules/pyyaml2/cyaml.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/cyaml.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader', 'CBaseDumper', 'CSafeDumper', 'CDumper'] diff --git a/python.d/python_modules/pyyaml2/dumper.py b/collectors/python.d.plugin/python_modules/pyyaml2/dumper.py index f811d2c91..3685cbeeb 100644 --- a/python.d/python_modules/pyyaml2/dumper.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/dumper.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] diff --git a/python.d/python_modules/pyyaml2/emitter.py b/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py index e5bcdcccb..9a460a0fd 100644 --- a/python.d/python_modules/pyyaml2/emitter.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/emitter.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Emitter expects events obeying the following grammar: # stream ::= STREAM-START document* STREAM-END diff --git a/python.d/python_modules/pyyaml2/error.py b/collectors/python.d.plugin/python_modules/pyyaml2/error.py index 577686db5..5466be721 100644 --- a/python.d/python_modules/pyyaml2/error.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/error.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] diff --git a/python.d/python_modules/pyyaml2/events.py b/collectors/python.d.plugin/python_modules/pyyaml2/events.py index f79ad389c..283452add 100644 --- a/python.d/python_modules/pyyaml2/events.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/events.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Abstract classes. diff --git a/python.d/python_modules/pyyaml2/loader.py b/collectors/python.d.plugin/python_modules/pyyaml2/loader.py index 293ff467b..1c195531f 100644 --- a/python.d/python_modules/pyyaml2/loader.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/loader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseLoader', 'SafeLoader', 'Loader'] diff --git a/python.d/python_modules/pyyaml2/nodes.py b/collectors/python.d.plugin/python_modules/pyyaml2/nodes.py index c4f070c41..ed2a1b43e 100644 --- a/python.d/python_modules/pyyaml2/nodes.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/nodes.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT class Node(object): def __init__(self, tag, value, start_mark, end_mark): diff --git a/python.d/python_modules/pyyaml2/parser.py b/collectors/python.d.plugin/python_modules/pyyaml2/parser.py index f9e3057f3..97ba08337 100644 --- a/python.d/python_modules/pyyaml2/parser.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/parser.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # The following YAML grammar is LL(1) and is parsed by a recursive descent # parser. diff --git a/python.d/python_modules/pyyaml2/reader.py b/collectors/python.d.plugin/python_modules/pyyaml2/reader.py index 3249e6b9f..8d422954e 100644 --- a/python.d/python_modules/pyyaml2/reader.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/reader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # This module contains abstractions for the input stream. You don't have to # looks further, there are no pretty code. # diff --git a/python.d/python_modules/pyyaml2/representer.py b/collectors/python.d.plugin/python_modules/pyyaml2/representer.py index 5f4fc70db..0a1404eca 100644 --- a/python.d/python_modules/pyyaml2/representer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/representer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', 'RepresenterError'] diff --git a/python.d/python_modules/pyyaml2/resolver.py b/collectors/python.d.plugin/python_modules/pyyaml2/resolver.py index 6b5ab8759..49922debf 100644 --- a/python.d/python_modules/pyyaml2/resolver.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/resolver.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseResolver', 'Resolver'] diff --git a/python.d/python_modules/pyyaml2/scanner.py b/collectors/python.d.plugin/python_modules/pyyaml2/scanner.py index 5228fad65..971da6127 100644 --- a/python.d/python_modules/pyyaml2/scanner.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/scanner.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Scanner produces tokens of the following types: # STREAM-START diff --git a/python.d/python_modules/pyyaml2/serializer.py b/collectors/python.d.plugin/python_modules/pyyaml2/serializer.py index 0bf1e96dc..15fdbb0c0 100644 --- a/python.d/python_modules/pyyaml2/serializer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/serializer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Serializer', 'SerializerError'] diff --git a/python.d/python_modules/pyyaml2/tokens.py b/collectors/python.d.plugin/python_modules/pyyaml2/tokens.py index 4d0b48a39..c5c4fb116 100644 --- a/python.d/python_modules/pyyaml2/tokens.py +++ b/collectors/python.d.plugin/python_modules/pyyaml2/tokens.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT class Token(object): def __init__(self, start_mark, end_mark): diff --git a/python.d/python_modules/pyyaml3/__init__.py b/collectors/python.d.plugin/python_modules/pyyaml3/__init__.py index a5e20f94d..a884b33cf 100644 --- a/python.d/python_modules/pyyaml3/__init__.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from .error import * diff --git a/python.d/python_modules/pyyaml3/composer.py b/collectors/python.d.plugin/python_modules/pyyaml3/composer.py index d5c6a7acd..c418bba91 100644 --- a/python.d/python_modules/pyyaml3/composer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/composer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Composer', 'ComposerError'] diff --git a/python.d/python_modules/pyyaml3/constructor.py b/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py index 981543aeb..ee09a7a7e 100644 --- a/python.d/python_modules/pyyaml3/constructor.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/constructor.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor', 'ConstructorError'] diff --git a/python.d/python_modules/pyyaml3/cyaml.py b/collectors/python.d.plugin/python_modules/pyyaml3/cyaml.py index d5cb87e99..e6c16d894 100644 --- a/python.d/python_modules/pyyaml3/cyaml.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/cyaml.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['CBaseLoader', 'CSafeLoader', 'CLoader', 'CBaseDumper', 'CSafeDumper', 'CDumper'] diff --git a/python.d/python_modules/pyyaml3/dumper.py b/collectors/python.d.plugin/python_modules/pyyaml3/dumper.py index 0b6912877..ba590c6e6 100644 --- a/python.d/python_modules/pyyaml3/dumper.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/dumper.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] diff --git a/python.d/python_modules/pyyaml3/emitter.py b/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py index 34cb145a5..d4be65a8e 100644 --- a/python.d/python_modules/pyyaml3/emitter.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/emitter.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Emitter expects events obeying the following grammar: # stream ::= STREAM-START document* STREAM-END diff --git a/python.d/python_modules/pyyaml3/error.py b/collectors/python.d.plugin/python_modules/pyyaml3/error.py index b796b4dc5..5fec7d449 100644 --- a/python.d/python_modules/pyyaml3/error.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/error.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] diff --git a/python.d/python_modules/pyyaml3/events.py b/collectors/python.d.plugin/python_modules/pyyaml3/events.py index f79ad389c..283452add 100644 --- a/python.d/python_modules/pyyaml3/events.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/events.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Abstract classes. diff --git a/python.d/python_modules/pyyaml3/loader.py b/collectors/python.d.plugin/python_modules/pyyaml3/loader.py index 08c8f01b3..7ef6cf815 100644 --- a/python.d/python_modules/pyyaml3/loader.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/loader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseLoader', 'SafeLoader', 'Loader'] diff --git a/python.d/python_modules/pyyaml3/nodes.py b/collectors/python.d.plugin/python_modules/pyyaml3/nodes.py index c4f070c41..ed2a1b43e 100644 --- a/python.d/python_modules/pyyaml3/nodes.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/nodes.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT class Node(object): def __init__(self, tag, value, start_mark, end_mark): diff --git a/python.d/python_modules/pyyaml3/parser.py b/collectors/python.d.plugin/python_modules/pyyaml3/parser.py index 13a5995d2..bcec7f994 100644 --- a/python.d/python_modules/pyyaml3/parser.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/parser.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # The following YAML grammar is LL(1) and is parsed by a recursive descent # parser. diff --git a/python.d/python_modules/pyyaml3/reader.py b/collectors/python.d.plugin/python_modules/pyyaml3/reader.py index f70e920f4..0a515fd64 100644 --- a/python.d/python_modules/pyyaml3/reader.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/reader.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # This module contains abstractions for the input stream. You don't have to # looks further, there are no pretty code. # diff --git a/python.d/python_modules/pyyaml3/representer.py b/collectors/python.d.plugin/python_modules/pyyaml3/representer.py index 67cd6fd25..756a18dcc 100644 --- a/python.d/python_modules/pyyaml3/representer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/representer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', 'RepresenterError'] diff --git a/python.d/python_modules/pyyaml3/resolver.py b/collectors/python.d.plugin/python_modules/pyyaml3/resolver.py index 0eece2582..50945e04d 100644 --- a/python.d/python_modules/pyyaml3/resolver.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/resolver.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['BaseResolver', 'Resolver'] diff --git a/python.d/python_modules/pyyaml3/scanner.py b/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py index 494d975ba..b55854e8b 100644 --- a/python.d/python_modules/pyyaml3/scanner.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/scanner.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Scanner produces tokens of the following types: # STREAM-START diff --git a/python.d/python_modules/pyyaml3/serializer.py b/collectors/python.d.plugin/python_modules/pyyaml3/serializer.py index fe911e67a..1ba2f7f9d 100644 --- a/python.d/python_modules/pyyaml3/serializer.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/serializer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT __all__ = ['Serializer', 'SerializerError'] diff --git a/python.d/python_modules/pyyaml3/tokens.py b/collectors/python.d.plugin/python_modules/pyyaml3/tokens.py index 4d0b48a39..c5c4fb116 100644 --- a/python.d/python_modules/pyyaml3/tokens.py +++ b/collectors/python.d.plugin/python_modules/pyyaml3/tokens.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT class Token(object): def __init__(self, start_mark, end_mark): diff --git a/python.d/python_modules/urllib3/packages/backports/__init__.py b/collectors/python.d.plugin/python_modules/third_party/__init__.py index e69de29bb..e69de29bb 100644 --- a/python.d/python_modules/urllib3/packages/backports/__init__.py +++ b/collectors/python.d.plugin/python_modules/third_party/__init__.py diff --git a/python.d/python_modules/third_party/lm_sensors.py b/collectors/python.d.plugin/python_modules/third_party/lm_sensors.py index 1d868f0e2..f10cd6209 100644 --- a/python.d/python_modules/third_party/lm_sensors.py +++ b/collectors/python.d.plugin/python_modules/third_party/lm_sensors.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: LGPL-2.1 """ @package sensors.py Python Bindings for libsensors3 @@ -254,4 +255,4 @@ class SubFeatureIterator: return subfeature def next(self): # python2 compability - return self.__next__()
\ No newline at end of file + return self.__next__() diff --git a/python.d/python_modules/third_party/ordereddict.py b/collectors/python.d.plugin/python_modules/third_party/ordereddict.py index d0b97d47c..589401b8f 100644 --- a/python.d/python_modules/third_party/ordereddict.py +++ b/collectors/python.d.plugin/python_modules/third_party/ordereddict.py @@ -1,24 +1,6 @@ # Copyright (c) 2009 Raymond Hettinger # -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation files -# (the "Software"), to deal in the Software without restriction, -# including without limitation the rights to use, copy, modify, merge, -# publish, distribute, sublicense, and/or sell copies of the Software, -# and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. +# SPDX-License-Identifier: MIT from UserDict import DictMixin diff --git a/python.d/python_modules/urllib3/__init__.py b/collectors/python.d.plugin/python_modules/urllib3/__init__.py index 26493ecb9..3add84816 100644 --- a/python.d/python_modules/urllib3/__init__.py +++ b/collectors/python.d.plugin/python_modules/urllib3/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ urllib3 - Thread-safe connection pooling and re-using. """ diff --git a/python.d/python_modules/urllib3/_collections.py b/collectors/python.d.plugin/python_modules/urllib3/_collections.py index 4849ddecd..c1d2fad36 100644 --- a/python.d/python_modules/urllib3/_collections.py +++ b/collectors/python.d.plugin/python_modules/urllib3/_collections.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from collections import Mapping, MutableMapping try: diff --git a/python.d/python_modules/urllib3/connection.py b/collectors/python.d.plugin/python_modules/urllib3/connection.py index c0d832998..f757493c7 100644 --- a/python.d/python_modules/urllib3/connection.py +++ b/collectors/python.d.plugin/python_modules/urllib3/connection.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import datetime import logging diff --git a/python.d/python_modules/urllib3/connectionpool.py b/collectors/python.d.plugin/python_modules/urllib3/connectionpool.py index b4f1166a6..90e4c86a5 100644 --- a/python.d/python_modules/urllib3/connectionpool.py +++ b/collectors/python.d.plugin/python_modules/urllib3/connectionpool.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import errno import logging diff --git a/python.d/python_modules/urllib3/contrib/_securetransport/bindings.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/bindings.py index e26b84086..bb826673f 100644 --- a/python.d/python_modules/urllib3/contrib/_securetransport/bindings.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/bindings.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ This module uses ctypes to bind a whole bunch of functions and constants from SecureTransport. The goal here is to provide the low-level API to diff --git a/python.d/python_modules/urllib3/contrib/_securetransport/low_level.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/low_level.py index 5e3494bce..0f79a1372 100644 --- a/python.d/python_modules/urllib3/contrib/_securetransport/low_level.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/_securetransport/low_level.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ Low-level helpers for the SecureTransport bindings. diff --git a/python.d/python_modules/urllib3/contrib/appengine.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/appengine.py index 814b0222d..e74589fa8 100644 --- a/python.d/python_modules/urllib3/contrib/appengine.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/appengine.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ This module provides a pool manager that uses Google App Engine's `URLFetch Service <https://cloud.google.com/appengine/docs/python/urlfetch>`_. diff --git a/python.d/python_modules/urllib3/contrib/ntlmpool.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/ntlmpool.py index 642e99ed2..3f8c9ebf5 100644 --- a/python.d/python_modules/urllib3/contrib/ntlmpool.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/ntlmpool.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ NTLM authenticating pool, contributed by erikcederstran diff --git a/python.d/python_modules/urllib3/contrib/pyopenssl.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/pyopenssl.py index 6645dbaa9..8d373507d 100644 --- a/python.d/python_modules/urllib3/contrib/pyopenssl.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/pyopenssl.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ SSL with SNI_-support for Python 2. Follow these instructions if you would like to verify SSL certificates in Python 2. Note, the default libraries do diff --git a/python.d/python_modules/urllib3/contrib/securetransport.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/securetransport.py index 72b23ab1c..fcc30118c 100644 --- a/python.d/python_modules/urllib3/contrib/securetransport.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/securetransport.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT """ SecureTranport support for urllib3 via ctypes. diff --git a/python.d/python_modules/urllib3/contrib/socks.py b/collectors/python.d.plugin/python_modules/urllib3/contrib/socks.py index 39e92fde1..1cb79285b 100644 --- a/python.d/python_modules/urllib3/contrib/socks.py +++ b/collectors/python.d.plugin/python_modules/urllib3/contrib/socks.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# SPDX-License-Identifier: MIT """ This module contains provisional support for SOCKS proxies from within urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and diff --git a/python.d/python_modules/urllib3/exceptions.py b/collectors/python.d.plugin/python_modules/urllib3/exceptions.py index 6c4be5810..a71cabe06 100644 --- a/python.d/python_modules/urllib3/exceptions.py +++ b/collectors/python.d.plugin/python_modules/urllib3/exceptions.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from .packages.six.moves.http_client import ( IncompleteRead as httplib_IncompleteRead diff --git a/python.d/python_modules/urllib3/fields.py b/collectors/python.d.plugin/python_modules/urllib3/fields.py index 19b0ae0c8..de7577b74 100644 --- a/python.d/python_modules/urllib3/fields.py +++ b/collectors/python.d.plugin/python_modules/urllib3/fields.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import email.utils import mimetypes diff --git a/python.d/python_modules/urllib3/filepost.py b/collectors/python.d.plugin/python_modules/urllib3/filepost.py index cd11cee46..3febc9cfe 100644 --- a/python.d/python_modules/urllib3/filepost.py +++ b/collectors/python.d.plugin/python_modules/urllib3/filepost.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import codecs diff --git a/python.d/python_modules/urllib3/packages/__init__.py b/collectors/python.d.plugin/python_modules/urllib3/packages/__init__.py index 170e974c1..170e974c1 100644 --- a/python.d/python_modules/urllib3/packages/__init__.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/__init__.py diff --git a/python.d/python_modules/urllib3/packages/backports/makefile.py b/collectors/python.d.plugin/python_modules/urllib3/packages/backports/makefile.py index 75b80dcf8..8ab122f8b 100644 --- a/python.d/python_modules/urllib3/packages/backports/makefile.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/backports/makefile.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# SPDX-License-Identifier: MIT """ backports.makefile ~~~~~~~~~~~~~~~~~~ diff --git a/python.d/python_modules/urllib3/packages/ordered_dict.py b/collectors/python.d.plugin/python_modules/urllib3/packages/ordered_dict.py index 4479363cc..9f7c0e6b8 100644 --- a/python.d/python_modules/urllib3/packages/ordered_dict.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/ordered_dict.py @@ -2,6 +2,7 @@ # Passes Python2.7's test suite and incorporates all the latest updates. # Copyright 2009 Raymond Hettinger, released under the MIT License. # http://code.activestate.com/recipes/576693/ +# SPDX-License-Identifier: MIT try: from thread import get_ident as _get_ident except ImportError: diff --git a/python.d/python_modules/urllib3/packages/six.py b/collectors/python.d.plugin/python_modules/urllib3/packages/six.py index 190c0239c..31df5012b 100644 --- a/python.d/python_modules/urllib3/packages/six.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/six.py @@ -2,23 +2,7 @@ # Copyright (c) 2010-2015 Benjamin Peterson # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# SPDX-License-Identifier: MIT from __future__ import absolute_import diff --git a/python.d/python_modules/urllib3/packages/ssl_match_hostname/__init__.py b/collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/__init__.py index d6594eb26..2aeeeff91 100644 --- a/python.d/python_modules/urllib3/packages/ssl_match_hostname/__init__.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT import sys try: diff --git a/python.d/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py b/collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py index 1fd42f38a..647e081da 100644 --- a/python.d/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py +++ b/collectors/python.d.plugin/python_modules/urllib3/packages/ssl_match_hostname/_implementation.py @@ -1,7 +1,6 @@ """The match_hostname() function from Python 3.3.3, essential when using SSL.""" -# Note: This file is under the PSF license as the code comes from the python -# stdlib. http://docs.python.org/3/license.html +# SPDX-License-Identifier: Python-2.0 import re import sys diff --git a/python.d/python_modules/urllib3/poolmanager.py b/collectors/python.d.plugin/python_modules/urllib3/poolmanager.py index 4ae91744d..adea9bc01 100644 --- a/python.d/python_modules/urllib3/poolmanager.py +++ b/collectors/python.d.plugin/python_modules/urllib3/poolmanager.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import collections import functools diff --git a/python.d/python_modules/urllib3/request.py b/collectors/python.d.plugin/python_modules/urllib3/request.py index c0fddff04..f78331975 100644 --- a/python.d/python_modules/urllib3/request.py +++ b/collectors/python.d.plugin/python_modules/urllib3/request.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from .filepost import encode_multipart_formdata diff --git a/python.d/python_modules/urllib3/response.py b/collectors/python.d.plugin/python_modules/urllib3/response.py index 408d9996a..cf14a3076 100644 --- a/python.d/python_modules/urllib3/response.py +++ b/collectors/python.d.plugin/python_modules/urllib3/response.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from contextlib import contextmanager import zlib diff --git a/python.d/python_modules/urllib3/util/__init__.py b/collectors/python.d.plugin/python_modules/urllib3/util/__init__.py index 2f2770b62..bba628d98 100644 --- a/python.d/python_modules/urllib3/util/__init__.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/__init__.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import # For backwards compatibility, provide imports that used to be here. from .connection import is_connection_dropped diff --git a/python.d/python_modules/urllib3/util/connection.py b/collectors/python.d.plugin/python_modules/urllib3/util/connection.py index bf699cfd0..3bd69e8fa 100644 --- a/python.d/python_modules/urllib3/util/connection.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/connection.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import socket from .wait import wait_for_read diff --git a/python.d/python_modules/urllib3/util/request.py b/collectors/python.d.plugin/python_modules/urllib3/util/request.py index 3ddfcd559..18f27b032 100644 --- a/python.d/python_modules/urllib3/util/request.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/request.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from base64 import b64encode diff --git a/python.d/python_modules/urllib3/util/response.py b/collectors/python.d.plugin/python_modules/urllib3/util/response.py index 67cf730ab..e4cda93d4 100644 --- a/python.d/python_modules/urllib3/util/response.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/response.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from ..packages.six.moves import http_client as httplib diff --git a/python.d/python_modules/urllib3/util/retry.py b/collectors/python.d.plugin/python_modules/urllib3/util/retry.py index c603cb490..61e63afec 100644 --- a/python.d/python_modules/urllib3/util/retry.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/retry.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import time import logging diff --git a/python.d/python_modules/urllib3/util/selectors.py b/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py index d75cb266b..c0997b1a2 100644 --- a/python.d/python_modules/urllib3/util/selectors.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT # Backport of selectors.py from Python 3.5+ to support Python < 3.4 # Also has the behavior specified in PEP 475 which is to retry syscalls # in the case of an EINTR error. This module is required because selectors34 diff --git a/python.d/python_modules/urllib3/util/ssl_.py b/collectors/python.d.plugin/python_modules/urllib3/util/ssl_.py index 33d428ed8..ece3ec39e 100644 --- a/python.d/python_modules/urllib3/util/ssl_.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/ssl_.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import import errno import warnings diff --git a/python.d/python_modules/urllib3/util/timeout.py b/collectors/python.d.plugin/python_modules/urllib3/util/timeout.py index cec817e6e..4041cf9b9 100644 --- a/python.d/python_modules/urllib3/util/timeout.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/timeout.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import # The default socket timeout, used by httplib to indicate that no timeout was # specified by the user diff --git a/python.d/python_modules/urllib3/util/url.py b/collectors/python.d.plugin/python_modules/urllib3/util/url.py index 6b6f9968d..99fd6534a 100644 --- a/python.d/python_modules/urllib3/util/url.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/url.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from __future__ import absolute_import from collections import namedtuple diff --git a/python.d/python_modules/urllib3/util/wait.py b/collectors/python.d.plugin/python_modules/urllib3/util/wait.py index cb396e508..21e72979c 100644 --- a/python.d/python_modules/urllib3/util/wait.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/wait.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: MIT from .selectors import ( HAS_SELECT, DefaultSelector, diff --git a/python.d/python_modules/__init__.py b/python.d/python_modules/__init__.py deleted file mode 100644 index 8d1c8b69c..000000000 --- a/python.d/python_modules/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py deleted file mode 100644 index 7c6e1d2f2..000000000 --- a/python.d/python_modules/base.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -# Description: backward compatibility with old version - -from bases.FrameworkServices.SimpleService import SimpleService -from bases.FrameworkServices.UrlService import UrlService -from bases.FrameworkServices.SocketService import SocketService -from bases.FrameworkServices.LogService import LogService -from bases.FrameworkServices.ExecutableService import ExecutableService -from bases.FrameworkServices.MySQLService import MySQLService |