From 0e8122a2fca6073d00a324790f3f6cf54e7c1baf Mon Sep 17 00:00:00 2001 From: Steven Pall Date: Sat, 17 Dec 2016 07:51:46 -0500 Subject: [PATCH] Add trailing slash to jolokia context (#2105) --- plugins/inputs/jolokia/README.md | 3 ++- plugins/inputs/jolokia/jolokia.go | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/jolokia/README.md b/plugins/inputs/jolokia/README.md index 596dbed5f..d25ab6f46 100644 --- a/plugins/inputs/jolokia/README.md +++ b/plugins/inputs/jolokia/README.md @@ -6,7 +6,8 @@ # Read JMX metrics through Jolokia [[inputs.jolokia]] ## This is the context root used to compose the jolokia url - context = "/jolokia" + ## NOTE that Jolokia requires a trailing slash at the end of the context root + context = "/jolokia/" ## This specifies the mode used # mode = "proxy" diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index 6a51e9b43..812e5e66b 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -52,8 +52,9 @@ type Jolokia struct { const sampleConfig = ` ## This is the context root used to compose the jolokia url + ## NOTE that Jolokia requires a trailing slash at the end of the context root ## NOTE that your jolokia security policy must allow for POST requests. - context = "/jolokia" + context = "/jolokia/" ## This specifies the mode used # mode = "proxy" @@ -148,7 +149,7 @@ func (j *Jolokia) doRequest(req *http.Request) (map[string]interface{}, error) { func (j *Jolokia) prepareRequest(server Server, metric Metric) (*http.Request, error) { var jolokiaUrl *url.URL - context := j.Context // Usually "/jolokia" + context := j.Context // Usually "/jolokia/" // Create bodyContent bodyContent := map[string]interface{}{