# Configuring multiple paths in http module

**URL:** <https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [February 26, 2018, 8:27pm UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564 "2018-02-26T20:27:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![diavel](https://avatars.discourse-cdn.com/v4/letter/d/ebca7d/32.png) [@diavel](https://discuss.elastic.co/u/diavel)\
**Post date:** [February 26, 2018, 8:27pm UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/1 "2018-02-26T20:27:17Z")

</div>

I am trying to use http module to collect jmx metrics instead of the jolokia module because of the lack of wild card in the queries. I am having trouble configuring multiple paths.

```
- module: http
      metricsets: ["json"]
      enabled: true
      period: 10s
      hosts: ["localhost:8008"]
      namespace: "metrics"
      method: POST
      paths:
        - path: "/jolokia/"
          body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "bytes-consumed-rate"}'
        - path: "/jolokia/"
          body: '{"type" : "read", "mbean" : "kafka.consumer:type=*,client-id=*", "attribute" : "commit-latency-avg"}'

```

This does not seem to work and I see errors.

`metrics.go:39: INFO Non-zero metrics in the last 30s: beat.info.uptime.ms=30000 beat.memstats.gc_next=4767600 beat.memstats.memory_alloc=4016168 beat.memstats.memory_total=47474256 libbeat.config.module.running=3 libbeat.output.read.bytes=4186 libbeat.output.write.bytes=16907 libbeat.pipeline.clients=7 libbeat.pipeline.events.active=0 libbeat.pipeline.events.published=18 libbeat.pipeline.events.total=18 libbeat.pipeline.queue.acked=18 metricbeat.http.json.events=3 metricbeat.http.json.failures=3`

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [February 27, 2018, 4:04am UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/2 "2018-02-27T04:04:44Z")

</div>

Could you enable debug logging and share the log file here? It should give us a better picture on what happens on the http side.

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [March 16, 2018, 12:42pm UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/3 "2018-03-16T12:42:51Z")

</div>

Unfortunately, multiple paths are not supported by the http module's _json_ metricset.

What you see in the config example is for the http module's _server_ metricset. This metricset does not query URLs. Instead it opens an http server on the specified port, and can receive input on multiple paths which are used to separate data into different namespaces.

I too want to collect JMX metrics from multiple HTTP endpoints.  
As a workaround I have added multiple http module definitions with individual paths, but that results in the mess of having multiple events sent to elasticsearch - which makes it harder to correlate related items. ☹

I believe having multiple paths in the json metricset would require a new feature to be implemented. The github issue tracker suggests to discuss the topic here, first. 🙂

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 16, 2018, 2:29pm UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/4 "2018-03-16T14:29:35Z")

</div>

Thanks for bringing it up first here.

My general expectation is that the metrics belonging together are available under one endpoint / path. That is why you have to configure it multiple times. But this does not seem to be the case for you. Can you share a bit more on your data set?

You mentation that you use Http for JMX data. I wonder if this is more an enhancement request that should be handled by JMX. Work is ongoing in JMX to support wildcards.

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [March 19, 2018, 10:07am UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/5 "2018-03-19T10:07:27Z")

</div>

In our case we use IBM Liberty which [provides its own JMX REST Interface](https://www.ibm.com/support/knowledgecenter/SSEQTP_liberty/com.ibm.websphere.wlp.doc/ae/twlp_admin_restconnector.html) - this is different from Jolokia, and does not work nicely if I grab multiple metrics at once - The HTTP Module's JSON parser cannot work with the output in those cases.

So grabbing multiple HTTP Endpoints to include in one Event would be helpful.

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 21, 2018, 7:40am UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/6 "2018-03-21T07:40:00Z")

</div>

Could you open a feature request for this? Alternatively I'm thinking if we should have a module for the above JMX rest interface instead of bending the http module to work for this.

---

<div class="post-metadata">

**Author:** ![BennyInc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bennyinc/32/21751_2.png) [@BennyInc](https://discuss.elastic.co/u/BennyInc)\
**Post date:** [March 28, 2018, 12:34pm UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/7 "2018-03-28T12:34:32Z")

</div>

I've now made another attempt at grabbing multiple metrics at once from the IBM Liberty JMX REST Interface. Basically this attempt boiled down to this error message in the published event:

```
"error": {
  "message": "json: cannot unmarshal array into Go value of type map[string]interface {}"
}

```

The output from the REST request (path: "/IBMJMXConnectorREST/mbeans/WebSphere%3Atype%3DJvmStats/attributes") is this:

`[{"name":"Heap","value":{"value":"1870659584","type":"java.lang.Long"}},{"name":"FreeMemory","value":{"value":"1498787264","type":"java.lang.Long"}},{"name":"GcCount","value":{"value":"631","type":"java.lang.Long"}},{"name":"UsedMemory","value":{"value":"371872320","type":"java.lang.Long"}},{"name":"ProcessCPU","value":{"value":"9.713427689998701","type":"java.lang.Double"}},{"name":"UpTime","value":{"value":"77110710","type":"java.lang.Long"}},{"name":"GcTime","value":{"value":"22053","type":"java.lang.Long"}}]`

So this is a JSON Array, which cannot be unmarshalled. **Further researching this, I found [that you already fixed this](https://github.com/elastic/beats/commit/4e9f33b2199bcac0d0fb8f7210ff7634d7abfe8a) 🤩**

(Unfortunately this was a day late for the 6.2.3 release, but I'll just wait for 6.2.4 now (or do you have nightlies available somewhere for people too lazy to set up a build env? (i.e. people like me)))

---

<div class="post-metadata">

**Author:** ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)\
**Post date:** [March 29, 2018, 5:12am UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/8 "2018-03-29T05:12:12Z")

</div>

You might like [https://beats-package-snapshots.s3.amazonaws.com/index.html](https://beats-package-snapshots.s3.amazonaws.com/index.html) Be aware that these are snapshots from master.

BTW the new feature will only be in 6.3 and not 6.2.4 as it's a bugfix release only.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 26, 2018, 5:12am UTC](https://discuss.elastic.co/t/configuring-multiple-paths-in-http-module/121564/9 "2018-04-26T05:12:14Z")

</div>

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