Make method in url service configurable (#4257)
* Make method in url service configurable #4127 * Add documentation for http method * wake up WIP
Chris committed
Sep 24, 2018 at 16:09 UTC
39385d786d0f2fd1b1aa05b571150f988d895f93
2 files changed
+3
-1
conf.d/python.d/httpcheck.conf
+1
@@ -66,6 +66,7 @@ chart_cleanup: 0
66
# url: 'http[s]://host-ip-or-dns[:port][path]'
67
# # [required] the remote host url to connect to. If [:port] is missing, it defaults to 80
68
# # for HTTP and 443 for HTTPS. [path] is optional too, defaults to /
69
+# method: GET # [optional] the HTTP request method (POST, PUT, DELETE, HEAD etc.)
70
# redirect: yes # [optional] If the remote host returns 3xx status codes, the redirection url will be
71
# # followed (default).
72
# status_accepted: # [optional] By default, 200 is accepted. Anything else will result in 'bad status' in the
python.d/python_modules/bases/FrameworkServices/UrlService.py
+2
-1
@@ -23,6 +23,7 @@ class UrlService(SimpleService):
23
self.proxy_user = self.configuration.get('proxy_user')
24
self.proxy_password = self.configuration.get('proxy_pass')
25
self.proxy_url = self.configuration.get('proxy_url')
26
+ self.method = self.configuration.get('method', 'GET')
27
self.header = self.configuration.get('header')
28
self.request_timeout = self.configuration.get('timeout', 1)
29
self.tls_verify = self.configuration.get('tls_verify')
@@ -110,7 +111,7 @@ class UrlService(SimpleService):
111
"""
112
url = url or self.url
113
manager = manager or self._manager
113
- response = manager.request(method='GET',
114
+ response = manager.request(method=self.method,
115
url=url,
116
timeout=self.request_timeout,
117
retries=retries,