@cryptotaxi247 / netdata-1 / commits / 11926704e

Rename charts and dimensions in portcheck

Chris committed Feb 25, 2018 at 22:48 UTC 11926704ecd1f4ca5cc52791321a3a37764d6ac5
4 files changed +18 -31
conf.d/Makefile.am
+1
@@ -102,6 +102,7 @@ dist_healthconfig_DATA = \
102 health.d/netfilter.conf \
103 health.d/nginx.conf \
104 health.d/nginx_plus.conf \
105 + health.d/portcheck.conf \
106 health.d/postgres.conf \
107 health.d/qos.conf \
108 health.d/ram.conf \
conf.d/health.d/portcheck.conf
+7 -19
@@ -1,6 +1,6 @@
1 template: portcheck_last_collected_secs
2 families: *
3 - on: portcheck.error
3 + on: portcheck.status
4 calc: $now - $last_collected_t
5 every: 10s
6 units: seconds ago
@@ -13,7 +13,7 @@ families: *
13 # This is a fast-reacting no-notification alarm ideal for custom dashboards or badges
14 template: service_reachable
15 families: *
16 - on: portcheck.error
16 + on: portcheck.status
17 lookup: average -1m unaligned percentage of success
18 calc: ($this < 75) ? (0) : ($this)
19 every: 5s
@@ -23,7 +23,7 @@ families: *
23
24 template: connection_timeouts
25 families: *
26 - on: portcheck.error
26 + on: portcheck.status
27 lookup: average -5m unaligned percentage of timeout
28 every: 10s
29 units: %
@@ -31,30 +31,18 @@ families: *
31 crit: $this >= 40
32 delay: down 5m multiplier 1.5 max 1h
33 info: average of timeouts during the last 5 minutes
34 + options: no-clear-notification
35 to: sysadmin
36
37 template: connection_fails
38 families: *
38 - on: portcheck.error
39 - lookup: average -5m unaligned percentage of failed
39 + on: portcheck.status
40 + lookup: average -5m unaligned percentage of no_connection
41 every: 10s
42 units: %
43 warn: $this >= 10 AND $this < 40
44 crit: $this >= 40
45 delay: down 5m multiplier 1.5 max 1h
46 info: average of failed connections during the last 5 minutes
47 + options: no-clear-notification
48 to: sysadmin
47 -
48 -# need help...
49 -
50 -#template: connection_latency
51 -#families: *
52 -# on: portcheck.latency
53 -# lookup: average -2m unaligned of connect
54 -# every: 5s
55 -# units: %
56 -# warn: $this >= 5 AND $this < 40
57 -# crit: $this >= 40
58 -# delay: down 5m multiplier 1.5 max 1h
59 -# info:
60 -# to: sysadmin
python.d/portcheck.chart.py
+6 -7
@@ -14,9 +14,9 @@ PORT_LATENCY = 'connect'
14
15 PORT_SUCCESS = 'success'
16 PORT_TIMEOUT = 'timeout'
17 -PORT_FAILED = 'failed'
17 +PORT_FAILED = 'no_connection'
18
19 -ORDER = ['latency', 'error']
19 +ORDER = ['latency', 'status']
20
21 CHARTS = {
22 'latency': {
@@ -25,12 +25,12 @@ CHARTS = {
25 [PORT_LATENCY, 'connect', 'absolute', 100, 1000]
26 ]
27 },
28 - 'error': {
29 - 'options': [None, 'Portcheck error code', 'yes/no', 'error', 'portcheck.error', 'line'],
28 + 'status': {
29 + 'options': [None, 'Portcheck status', 'flag', 'status', 'portcheck.status', 'line'],
30 'lines': [
31 [PORT_SUCCESS, 'success', 'absolute'],
32 [PORT_TIMEOUT, 'timeout', 'absolute'],
33 - [PORT_FAILED, 'failed', 'absolute']
33 + [PORT_FAILED, 'no connection', 'absolute']
34 ]}
35 }
36
@@ -70,7 +70,6 @@ class Service(SimpleService):
70 :return: dict
71 """
72 data = dict()
73 - data[PORT_LATENCY] = 0
73 data[PORT_SUCCESS] = 0
74 data[PORT_TIMEOUT] = 0
75 data[PORT_FAILED] = 0
@@ -126,7 +125,7 @@ class Service(SimpleService):
125 address=sa[0], port=port, latency=diff
126 ))
127 # we will set it at least 0.1 ms. 0.0 would mean failed connection (handy for 3rd-party-APIs)
129 - data[PORT_LATENCY] = max(round(diff * 10000), 1)
128 + data[PORT_LATENCY] = max(round(diff * 10000), 0)
129 data[PORT_SUCCESS] = 1
130
131 except socket.timeout as error:
web/dashboard_info.js
+4 -5
@@ -1729,15 +1729,14 @@ netdataDashboard.context = {
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. ' +
1732 - 'The minimum is <code>0.1 ms</code> except on errors, where it will be <code>0.0 ms</code>. ' +
1732 'Currently, the accuracy of the latency is low and should be used as reference only.'
1733 },
1734
1736 - 'portcheck.error': {
1735 + 'portcheck.status': {
1736 valueRange: "[0, 1]",
1738 - info: 'The <code>error</code> codes are returned by the plugin when it could verify the availability of the service. ' +
1739 - 'Each error dimension will have a value of <code>1</code> if triggered. Dimension <code>success</code> is always <code>1</code> if connection could be established.' +
1740 - 'The error code is most useful for alarms and third-party apps.'
1737 + info: 'The <code>status</code> chart verifies the availability of the service. ' +
1738 + 'Each status dimension will have a value of <code>1</code> if triggered. Dimension <code>success</code> is <code>1</code> only if connection could be established.' +
1739 + 'This chart is most useful for alarms and third-party apps.'
1740 },
1741
1742 // ------------------------------------------------------------------------