summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris <github.account@chrigel.net>2018-09-24 16:09:41 +0200
committerPaweł Krupa <pawel@krupa.net.pl>2018-09-24 16:09:41 +0200
commit39385d786d0f2fd1b1aa05b571150f988d895f93 (patch)
tree5ff10335c505b95621f598cb35e02faffc7afb6e
parent53e8c5ab747965ebc1a5fab342168a1adabeb580 (diff)
Make method in url service configurable (#4257)
* Make method in url service configurable #4127 * Add documentation for http method * wake up WIP
-rw-r--r--conf.d/python.d/httpcheck.conf1
-rw-r--r--python.d/python_modules/bases/FrameworkServices/UrlService.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/conf.d/python.d/httpcheck.conf b/conf.d/python.d/httpcheck.conf
index 058e057a65..bd21b5af87 100644
--- a/conf.d/python.d/httpcheck.conf
+++ b/conf.d/python.d/httpcheck.conf
@@ -66,6 +66,7 @@ chart_cleanup: 0
# url: 'http[s]://host-ip-or-dns[:port][path]'
# # [required] the remote host url to connect to. If [:port] is missing, it defaults to 80
# # for HTTP and 443 for HTTPS. [path] is optional too, defaults to /
+# method: GET # [optional] the HTTP request method (POST, PUT, DELETE, HEAD etc.)
# redirect: yes # [optional] If the remote host returns 3xx status codes, the redirection url will be
# # followed (default).
# status_accepted: # [optional] By default, 200 is accepted. Anything else will result in 'bad status' in the
diff --git a/python.d/python_modules/bases/FrameworkServices/UrlService.py b/python.d/python_modules/bases/FrameworkServices/UrlService.py
index 863713d3f8..68f7e86e41 100644
--- a/python.d/python_modules/bases/FrameworkServices/UrlService.py
+++ b/python.d/python_modules/bases/FrameworkServices/UrlService.py
@@ -23,6 +23,7 @@ class UrlService(SimpleService):
self.proxy_user = self.configuration.get('proxy_user')
self.proxy_password = self.configuration.get('proxy_pass')
self.proxy_url = self.configuration.get('proxy_url')
+ self.method = self.configuration.get('method', 'GET')
self.header = self.configuration.get('header')
self.request_timeout = self.configuration.get('timeout', 1)
self.tls_verify = self.configuration.get('tls_verify')
@@ -110,7 +111,7 @@ class UrlService(SimpleService):
"""
url = url or self.url
manager = manager or self._manager
- response = manager.request(method='GET',
+ response = manager.request(method=self.method,
url=url,
timeout=self.request_timeout,
retries=retries,