@cryptotaxi247 / netdata-1 / commits / 0ca8611bf

Add 0 to port latency on errors, otherwise the chart will get suppressed on error recovery.

Chris committed Feb 25, 2018 at 14:44 UTC 0ca8611bfae58d54e2d2a6bd24f255dd3ca0c275
2 files changed +7 -6
python.d/portcheck.chart.py
+5 -5
@@ -10,7 +10,7 @@ from bases.FrameworkServices.SimpleService import SimpleService
10 priority = 60000
11 retries = 60
12
13 -PORT_CONNECT = 'connect'
13 +PORT_LATENCY = 'connect'
14
15 PORT_SUCCESS = 'success'
16 PORT_TIMEOUT = 'timeout'
@@ -22,11 +22,11 @@ CHARTS = {
22 'latency': {
23 'options': [None, 'TCP connect latency', 'ms', 'latency', 'portcheck.latency', 'line'],
24 'lines': [
25 - [PORT_CONNECT, 'connect', 'absolute', 100, 1000]
25 + [PORT_LATENCY, 'connect', 'absolute', 100, 1000]
26 ]
27 },
28 'error': {
29 - 'options': [None, 'Portcheck error code', 'code', 'error', 'portcheck.error', 'line'],
29 + 'options': [None, 'Portcheck error code', 'yes/no', 'error', 'portcheck.error', 'line'],
30 'lines': [
31 [PORT_SUCCESS, 'success', 'absolute'],
32 [PORT_TIMEOUT, 'timeout', 'absolute'],
@@ -70,7 +70,7 @@ class Service(SimpleService):
70 :return: dict
71 """
72 data = dict()
73 -
73 + data[PORT_LATENCY] = 0
74 data[PORT_SUCCESS] = 0
75 data[PORT_TIMEOUT] = 0
76 data[PORT_FAILED] = 0
@@ -126,7 +126,7 @@ class Service(SimpleService):
126 address=sa[0], port=port, latency=diff
127 ))
128 # we will set it at least 0.1 ms. 0.0 would mean failed connection (handy for 3rd-party-APIs)
129 - data[PORT_CONNECT] = max(round(diff * 10000), 1)
129 + data[PORT_LATENCY] = max(round(diff * 10000), 1)
130 data[PORT_SUCCESS] = 1
131
132 except socket.timeout as error:
web/dashboard_info.js
+2 -1
@@ -1728,7 +1728,8 @@ netdataDashboard.context = {
1728 // Port check
1729
1730 'portcheck.latency': {
1731 - info: 'The <code>latency</code> describes the time spent connecting to a TCP port. No data is sent or received. ' +
1731 + info: 'The <code>latency</code> describes the time spent connecting to a TCP port. No data is sent or received. ' +
1732 + 'The minimum is <code>0.1 ms</code> except on errors, where it will be <code>0.0 ms</code>. ' +
1733 'Currently, the accuracy of the latency is low and should be used as reference only.'
1734 },
1735