httpcheck optimization
Chris committed
Feb 20, 2018 at 19:21 UTC
43c5b683d67df162ec3ad956c46cc9eb70169ef3
1 file changed
+4
-3
python.d/httpcheck.chart.py
+4
-3
@@ -91,13 +91,14 @@ class Service(UrlService):
91
)
92
diff = time.time() - start
93
data[HTTP_RESPONSE_TIME] = max(round(diff * 10000), 1)
94
+ self.debug('Url: {url}. Host responded with status code {code} in {diff} ms'.format(
95
+ url=url, code=response.status, diff=diff
96
+ ))
97
95
- self.debug('Url: {url}. Http response status code: {code}'.format(url=url, code=response.status))
98
if response.status in self.status_codes_accepted:
99
content = response.data
100
self.debug('Content: \n\n{content}\n'.format(content=content))
99
- match = self.regex.search(content)
100
- if match is None:
101
+ if self.regex.search(content) is None:
102
self.debug('No match for regex \'{regex}\' found'.format(regex=self.regex.pattern))
103
data[HTTP_ERROR] = CONTENT_MISMATCH
104
else: