Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jolokia add optional authentication parameters #414

Closed
jrxFive opened this issue Dec 2, 2015 · 5 comments · Fixed by #416
Closed

jolokia add optional authentication parameters #414

jrxFive opened this issue Dec 2, 2015 · 5 comments · Fixed by #416

Comments

@jrxFive
Copy link
Contributor

jrxFive commented Dec 2, 2015

Attempting to use the jolokia plugin against a service that has credentials established, I see no option to add credentials to the config file, unable to query endpoints, automatically get:

Missing key 'value' in 'http://<IP>:8161/jolokia/read/java.lang:type=Memory/HeapMemoryUsage' output response
Missing key 'value' in 'http://<IP>:8161/jolokia/read/java.lang:type=MemoryPool,name=PS%20Eden%20Space/Usage' output response
Missing key 'value' in 'http://<IP>:8161/jolokia/read/java.lang:type=Threading' output response

When attempting a http call to test manually:

http http://<IP>:8161/api/jolokia/read/java.lang:type=Memory/HeapMemoryUsage
HTTP/1.1 401 Unauthorized
Cache-Control: must-revalidate,no-cache,no-store
Content-Length: 1392
Content-Type: text/html;charset=ISO-8859-1
Server: Jetty(8.1.16.v20140903)
WWW-Authenticate: basic realm="ActiveMQRealm"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing /api/jolokia/read/java.lang:type=Memory/HeapMemoryUsage. Reason:
<pre>    Unauthorized</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

Same call with credentials specified:

http -a <u>:<p> http://<IP>:8161/api/jolokia/read/java.lang:type=Memory/HeapMemoryUsage
HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 204
Content-Type: text/plain;charset=UTF-8
Date: Wed, 02 Dec 2015 21:57:17 GMT
Expires: Wed, 02 Dec 2015 20:57:17 GMT
Pragma: no-cache
Server: Jetty(8.1.16.v20140903)

{"timestamp":1449093437,"status":200,"request":{"mbean":"java.lang:type=Memory","attribute":"HeapMemoryUsage","type":"read"},"value":{"max":468320256,"committed":56229888,"init":30156928,"used":40883248}}
@jrxFive jrxFive changed the title jolokia add authentication parameters jolokia add optional authentication parameters Dec 2, 2015
@sparrc
Copy link
Contributor

sparrc commented Dec 2, 2015

Okay, thanks for the report @jrxFive, shouldn't be too hard to add credentials

@sparrc
Copy link
Contributor

sparrc commented Dec 3, 2015

@jrxFive my change will add the credentials directly into the URL, can you check that this works?:

http http://<u>:<p>@<IP>:8161/api/jolokia/read/java.lang:type=Memory/HeapMemoryUsage

@jrxFive
Copy link
Contributor Author

jrxFive commented Dec 3, 2015

@sparrc it works :D thank you!

@sparrc
Copy link
Contributor

sparrc commented Dec 3, 2015

@jrxFive Great, thanks!

@sri-05
Copy link

sri-05 commented Jun 15, 2020

Hi Can anyone please let me the configuration to get 401 (unauthorized ) response when a call is not included with username and password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants