Add custom headers to fleet-managed ActiveMQ integration

I am using a fleet-managed agent with the ActiveMQ integration to attempt to monitor ActiveMQ metrics. When I deploy, I get this error from the agent:

[elastic_agent.metricbeat][error] Error fetching data for metricset activemq.queue: failed to unmarshal jolokia JSON response '{"error_type":"java.lang.Exception","error":"java.lang.Exception : Origin null is not allowed to call this agent","status":403}': json: cannot unmarshal object into Go value of type []jmx.Entry

In doing some research, it appears that the only thing required to resolve this error is to add an Origin: ... header to the HTTP request, e.g.:

Origin: http://localhost

And, in fact, when I execute that from the command line as follows, I am able to retrieve the data I'm looking for:

curl -ks -u ${USERNAME}:${PASSWORD} 'http://localhost:8161/api/jolokia/?ignoreErrors=true&canonicalNaming=false' -H 'Origin: http://localhost'

However, I don't appear to be able to add any custom headers to a Fleet-managed ActiveMQ integration. Is this possible, and how do I do it?

When I dug into how the policy is built/deployed, there is an "SSL Configuration" field under the metrics advanced configuration (see below).

Screen Shot 2022-11-02 at 8.31.11 AM

However, based on the sample shown in the field, it appears to be more of a generic "additional configuration" field, so I added the following:

headers:
  Origin: 'http://localhost'

and redeployed, which resolved the issue. I was also able to successfully add event processors to the integration using this.

I don't know whether this will change in the future, but it works for now. I would strongly suggest that this field be changed from "SSL Configuration" to "Additional Configuration."

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.