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/portcheck.chart.py | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz netdata-a64a253794ac64cb40befee54db53bde17dd0d49.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/python.d.plugin/portcheck/portcheck.chart.py (renamed from python.d/portcheck.chart.py) | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python.d/portcheck.chart.py b/collectors/python.d.plugin/portcheck/portcheck.chart.py index 0a312210d..e86f82544 100644 --- a/python.d/portcheck.chart.py +++ b/collectors/python.d.plugin/portcheck/portcheck.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: simple port check netdata python.d module # Original Author: ccremer (github.com/ccremer) +# SPDX-License-Identifier: GPL-3.0-or-later import socket @@ -36,7 +37,8 @@ CHARTS = { [PORT_SUCCESS, 'success', 'absolute'], [PORT_TIMEOUT, 'timeout', 'absolute'], [PORT_FAILED, 'no connection', 'absolute'] - ]} + ] + } } @@ -56,13 +58,13 @@ class Service(SimpleService): :return: boolean """ if self.host is None or self.port is None: - self.error("Host or port missing") + self.error('Host or port missing') return False if not isinstance(self.port, int): self.error('"port" is not an integer. Specify a numerical value, not service name.') return False - self.debug("Enabled portcheck: {host}:{port}, update every {update}s, timeout: {timeout}s".format( + self.debug('Enabled portcheck: {host}:{port}, update every {update}s, timeout: {timeout}s'.format( host=self.host, port=self.port, update=self.update_every, timeout=self.timeout )) # We will accept any (valid-ish) configuration, even if initial connection fails (a service might be down from @@ -101,7 +103,7 @@ class Service(SimpleService): return data def _create_socket(self, socket_config): - af, sock_type, proto, canon_name, sa = socket_config + af, sock_type, proto, _, sa = socket_config try: self.debug('Creating socket to "{address}", port {port}'.format(address=sa[0], port=sa[1])) sock = socket.socket(af, sock_type, proto) @@ -119,7 +121,7 @@ class Service(SimpleService): :return: dict """ - af, sock_type, proto, canon_name, sa = socket_config + af, _, proto, _, sa = socket_config port = str(sa[1]) try: self.debug('Connecting socket to "{address}", port {port}'.format(address=sa[0], port=port)) |