Error in plugin: Unable to gather metrics with jolokia2_agent

Hi,

I am using jolokia2 agent and the following is the authentication part in telegraf.conf.

[[inputs.jolokia2_agent]]
urls = [“http://xx.xxx.xx.xxx:1111/jolokia”]
username = “test”
password = “test123”
name_prefix = “weblogic.”

Below is the error message:

Error in plugin: Unable to gather metrics for …:1111/jolokia: Response from url “… :1111/jolokia” has status code 403 (Forbidden), expected 200 (OK)

Is my way of specifying the credentials correct? I am sure the credentials works as I saw results when I directly accessed to the url from my local after entering the credentials. Is there any other reason resulting in the error? Could that be related to any access/permission I need to grant the account on weblogic instance?

Thanks!

Your way of specifying the credentials looks ok to me. If the url is also correct, I don’t know what else could cause the error. From telegraf’s perspective, it made the request and was denied.

The “403 (Forbidden)” status code does make it sound like the server thinks there’s a permission problem, but I’m not familiar with weblogic and can’t tell you what to do on that side.

I had faced a similar issue. My issue was that jolokia doesn’t have POST permission. So I have changed the jolokia security policy. Added followed config.

<http>
  <method>post</method>
</http>

Refer this: Chapter 4. Security

Hopefully, this will help you out too.