@cryptotaxi247 / netdata-1 / commits / 911d51e1e

Renaming charts and dimension in httpcheck

Chris committed Feb 25, 2018 at 22:47 UTC 911d51e1ec4bc3f33cee923e5d2ec3b006da44b7
4 files changed +57 -45
conf.d/Makefile.am
+1
@@ -87,6 +87,7 @@ dist_healthconfig_DATA = \
87 health.d/entropy.conf \
88 health.d/fping.conf \
89 health.d/haproxy.conf \
90 + health.d/httpcheck.conf \
91 health.d/ipc.conf \
92 health.d/ipfs.conf \
93 health.d/ipmi.conf \
conf.d/health.d/httpcheck.conf
+17 -14
@@ -1,6 +1,6 @@
1 template: httpcheck_last_collected_secs
2 families: *
3 - on: httpcheck.error
3 + on: httpcheck.status
4 calc: $now - $last_collected_t
5 every: 10s
6 units: seconds ago
@@ -8,12 +8,13 @@ families: *
8 crit: $this > (($status == $CRITICAL) ? ($update_every) : (60 * $update_every))
9 delay: down 5m multiplier 1.5 max 1h
10 info: number of seconds since the last successful data collection
11 + options: no-clear-notification
12 to: sysadmin
13
14 # This is a fast-reacting no-notification alarm ideal for custom dashboards or badges
15 template: web_service_reachable
16 families: *
16 - on: httpcheck.error
17 + on: httpcheck.status
18 lookup: average -1m unaligned percentage of success
19 calc: ($this < 75) ? (0) : ($this)
20 every: 5s
@@ -21,33 +22,35 @@ families: *
22 info: at least 75% verified responses during last 60 seconds, ideal for badges
23 to: silent
24
24 -template: web_service_unexpected_contents
25 +template: web_service_bad_content_received
26 families: *
26 - on: httpcheck.error
27 - lookup: average -5m unaligned percentage of unexpected_content
27 + on: httpcheck.status
28 + lookup: average -5m unaligned percentage of bad_content
29 every: 10s
30 units: %
31 warn: $this >= 10 AND $this < 40
32 crit: $this >= 40
33 delay: down 5m multiplier 1.5 max 1h
34 info: average of unexpected http response content during the last 5 minutes
35 + options: no-clear-notification
36 to: webmaster
37
36 -template: web_service_unexpected_status
38 +template: web_service_bad_status
39 families: *
38 - on: httpcheck.error
39 - lookup: average -5m unaligned percentage of unexpected_status
40 + on: httpcheck.status
41 + lookup: average -5m unaligned percentage of bad_status
42 every: 10s
43 units: %
44 warn: $this >= 10 AND $this < 40
45 crit: $this >= 40
46 delay: down 5m multiplier 1.5 max 1h
45 - info: average of unexpected http status during the last 5 minutes
47 + info: average of bad http status during the last 5 minutes
48 + options: no-clear-notification
49 to: webmaster
50
51 template: web_service_timeouts
52 families: *
50 - on: httpcheck.error
53 + on: httpcheck.status
54 lookup: average -5m unaligned percentage of timeout
55 every: 10s
56 units: %
@@ -55,22 +58,22 @@ families: *
58 crit: $this >= 40
59 delay: down 5m multiplier 1.5 max 1h
60 info: average of timeouts during the last 5 minutes
61 + options: no-clear-notification
62 to: webmaster
63
64 template: web_service_fails
65 families: *
62 - on: httpcheck.error
63 - lookup: average -5m unaligned percentage of failed
66 + on: httpcheck.status
67 + lookup: average -5m unaligned percentage of no_connection
68 every: 10s
69 units: %
70 warn: $this >= 10 AND $this < 40
71 crit: $this >= 40
72 delay: down 5m multiplier 1.5 max 1h
73 info: average of failed requests during the last 5 minutes
74 + options: no-clear-notification
75 to: webmaster
76
72 -# need help...
73 -
77 #template: web_service_latency
78 #families: *
79 # on: httpcheck.responsetime
python.d/httpcheck.chart.py
+32 -27
@@ -18,32 +18,38 @@ except AttributeError:
18 priority = 60000
19 retries = 60
20
21 -# Latency
22 -HTTP_RESPONSE_TIME = 'response_time'
21 +# Response
22 +HTTP_RESPONSE_TIME = 'time'
23 +HTTP_RESPONSE_LENGTH = 'length'
24
24 -# Error dimensions
25 +# Status dimensions
26 HTTP_SUCCESS = 'success'
26 -HTTP_UNEXPECTED_CONTENT = 'unexpected_content'
27 -HTTP_UNEXPECTED_STATUS = 'unexpected_status'
27 +HTTP_BAD_CONTENT = 'bad_content'
28 +HTTP_BAD_STATUS = 'bad_status'
29 HTTP_TIMEOUT = 'timeout'
29 -HTTP_FAILED = 'failed'
30 +HTTP_NO_CONNECTION = 'no_connection'
31
31 -ORDER = ['responsetime', 'error']
32 +ORDER = ['response_time', 'response_length', 'status']
33
34 CHARTS = {
34 - 'responsetime': {
35 - 'options': [None, 'HTTP response time', 'ms', 'response time', 'httpcheck.responsetime', 'line'],
35 + 'response_time': {
36 + 'options': [None, 'HTTP response time', 'ms', 'response', 'httpcheck.responsetime', 'line'],
37 'lines': [
37 - [HTTP_RESPONSE_TIME, 'response time', 'absolute', 100, 1000]
38 + [HTTP_RESPONSE_TIME, 'time', 'absolute', 100, 1000]
39 ]},
39 - 'error': {
40 - 'options': [None, 'HTTP check error code', 'yes/no', 'error', 'httpcheck.error', 'line'],
40 + 'response_length': {
41 + 'options': [None, 'HTTP response body length', 'characters', 'response', 'httpcheck.responselength', 'line'],
42 + 'lines': [
43 + [HTTP_RESPONSE_LENGTH, 'length', 'absolute']
44 + ]},
45 + 'status': {
46 + 'options': [None, 'HTTP status', 'flag', 'status', 'httpcheck.status', 'line'],
47 'lines': [
48 [HTTP_SUCCESS, 'success', 'absolute'],
43 - [HTTP_UNEXPECTED_CONTENT, 'unexpected content', 'absolute'],
44 - [HTTP_UNEXPECTED_STATUS, 'unexpected status', 'absolute'],
49 + [HTTP_BAD_CONTENT, 'bad content', 'absolute'],
50 + [HTTP_BAD_STATUS, 'bad status', 'absolute'],
51 [HTTP_TIMEOUT, 'timeout', 'absolute'],
46 - [HTTP_FAILED, 'failed', 'absolute']
52 + [HTTP_NO_CONNECTION, 'no connection', 'absolute']
53 ]}
54 }
55
@@ -84,12 +90,11 @@ class Service(UrlService):
90 :return: dict
91 """
92 data = dict()
87 - data[HTTP_RESPONSE_TIME] = 0
93 data[HTTP_SUCCESS] = 0
89 - data[HTTP_UNEXPECTED_CONTENT] = 0
90 - data[HTTP_UNEXPECTED_STATUS] = 0
94 + data[HTTP_BAD_CONTENT] = 0
95 + data[HTTP_BAD_STATUS] = 0
96 data[HTTP_TIMEOUT] = 0
92 - data[HTTP_FAILED] = 0
97 + data[HTTP_NO_CONNECTION] = 0
98 url = self.url
99 try:
100 retr = 1 if self.follow_redirect else False
@@ -98,26 +103,26 @@ class Service(UrlService):
103 method='GET', url=url, timeout=self.request_timeout, retries=retr, headers=self._manager.headers,
104 redirect=self.follow_redirect
105 )
106 + content = response.data
107 diff = time.time() - start
102 - data[HTTP_RESPONSE_TIME] = max(round(diff * 10000), 1)
108 + data[HTTP_RESPONSE_TIME] = max(round(diff * 10000), 0)
109 + data[HTTP_RESPONSE_LENGTH] = len(content)
110 self.debug('Url: {url}. Host responded with status code {code} in {diff} s'.format(
111 url=url, code=response.status, diff=diff
112 ))
106 -
113 + self.debug('Content: \n\n{content}\n'.format(content=content))
114 if response.status in self.status_codes_accepted:
108 - content = response.data
109 - self.debug('Content: \n\n{content}\n'.format(content=content))
115 if self.regex.search(content) is None:
116 self.debug('No match for regex \'{regex}\' found'.format(regex=self.regex.pattern))
112 - data[HTTP_UNEXPECTED_CONTENT] = 1
117 + data[HTTP_BAD_CONTENT] = 1
118 else:
119 data[HTTP_SUCCESS] = 1
120 else:
116 - data[HTTP_UNEXPECTED_STATUS] = 1
121 + data[HTTP_BAD_STATUS] = 1
122
123 except urllib3.exceptions.NewConnectionError as error:
124 self.debug("Connection failed: {url}. Error: {error}".format(url=url, error=error))
120 - data[HTTP_FAILED] = 1
125 + data[HTTP_NO_CONNECTION] = 1
126
127 except (urllib3.exceptions.TimeoutError, urllib3.exceptions.PoolError) as error:
128 self.debug("Connection timed out: {url}. Error: {error}".format(url=url, error=error))
@@ -125,7 +130,7 @@ class Service(UrlService):
130
131 except urllib3.exceptions.HTTPError as error:
132 self.debug("Connection failed: {url}. Error: {error}".format(url=url, error=error))
128 - data[HTTP_FAILED] = 1
133 + data[HTTP_NO_CONNECTION] = 1
134
135 except (TypeError, AttributeError) as error:
136 self.error('Url: {url}. Error: {error}'.format(url=url, error=error))
web/dashboard_info.js
+7 -4
@@ -1138,14 +1138,17 @@ netdataDashboard.context = {
1138
1139 'httpcheck.responsetime': {
1140 info: 'The <code>response time</code> describes the time passed between request and response. ' +
1141 - 'The minimum is <code>0.1 ms</code> except on errors, where it will be <code>0.0 ms</code>. ' +
1141 'Currently, the accuracy of the response time is low and should be used as reference only.'
1142 },
1143
1145 - 'httpcheck.error': {
1144 + 'httpcheck.responselength': {
1145 + info: 'The <code>response length</code> counts the number of characters in the response body. For static pages, this should be mostly constant.'
1146 + },
1147 +
1148 + 'httpcheck.status': {
1149 valueRange: "[0, 1]",
1147 - info: 'The <code>error</code> codes are returned by the plugin when it could verify the availability of the webserver. ' +
1148 - 'Each error dimension will have a value of <code>1</code> if triggered. Dimension <code>success</code> is <code>1</code> if all constraints are satisfied.' +
1150 + info: 'This chart verifies the response of the webserver. Each status dimension will have a value of <code>1</code> if triggered. ' +
1151 + 'Dimension <code>success</code> is <code>1</code> only if all constraints are satisfied.' +
1152 'This chart is most useful for alarms or third-party apps.'
1153 },
1154