# MetricBeat tomcat module with HTTPS

**URL:** https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313
**Category:** Beats
**Tags:** metricbeat
**Created:** [February 21, 2020, 8:54am UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313 "2020-02-21T08:54:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [February 21, 2020, 8:54am UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/1 "2020-02-21T08:54:29Z")

</div>

Hi guys,

I have just tried to get the BETA version of the tomcat module to work with our tomcat(8.0.x) which only allows HTTPS connections. My configuration of the module(MetricBeat 7.6.0) is this:

> ```
> - module: tomcat
> metricsets: ['threading', 'cache', 'memory', 'requests']
> period: 10s
> hosts: ['https://myhost.mycompany.com:8443']
> ssl.certificate_authorities: ["/home/tomcat/intermediate.crt","/home/tomcat/root.crt"]
> path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"
> username: "metricbeat"
> password: "${tomcat.password}"
> 
> ```

This server configuration works with the jolokia module while the tomcat module gives the following error:

> 2020-02-21T08:35:16.881+0100 INFO module/wrapper.go:252 Error fetching data for metricset tomcat.threading: error making http request: Post [http://myhost.mycompany.com:8443/jolokia/%3FignoreErrors=true&canonicalNaming=false:](http://myhost.mycompany.com:8443/jolokia/%3FignoreErrors=true&canonicalNaming=false:) net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x03\x00\x02\x02P"

Interesting is: While I supplied https in the hosts uri metricbeat still tried to connect using http. Also, I am confused why the question mark in the path setting has been encoded as %3F in the URL(or is this a logging only problem?).

Does the tomcat module not yet support HTTPS or am I missing something?

Best regards  
Wolfram

---

<div class="post-metadata">

### Author: ![Mario\_Castro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mario_castro/32/35107_2.png) [@Mario\_Castro](https://discuss.elastic.co/u/Mario_Castro)
#### Post date: [February 25, 2020, 10:23am UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/2 "2020-02-25T10:23:57Z")

</div>

Hi @Wolfram_Haussig 🙂

HTTPS is one of the few things we haven't tested in the module yet (that's why it's in beta still). We are waiting for some contribution from people who is using in production so we get a broader and more general idea of how to approach it. This particular module was developed only using HTTP.

Can you open us a github [issue](https://github.com/elastic/beats) providing some walkthrough of your happy path to setup and deploy it? This way some contributor can choose to develop it if he/she has the knowledge for it

Thanks for the heads up!

EDIT: Forgot to mention that the module uses the [Jolokia](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-jolokia.html) module under the hood, maybe you are just lacking to specify the SSL settings there. It will be nice to know if you make it work then.

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [March 2, 2020, 6:14am UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/3 "2020-03-02T06:14:03Z")

</div>

Hello Mario,

I tried the same setup with the jolokia module which worked so I will open an issue in your repo.

Best regards  
Wolfram

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [March 2, 2020, 11:39am UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/4 "2020-03-02T11:39:11Z")

</div>

This issue should be solved by [https://github.com/elastic/beats/pull/16205](https://github.com/elastic/beats/pull/16205)

Thanks for reporting!

---

<div class="post-metadata">

### Author: ![seddikalaouiismaili](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seddikalaouiismaili/32/87834_2.png) [@seddikalaouiismaili](https://discuss.elastic.co/u/seddikalaouiismaili)
#### Post date: [March 3, 2020, 1:18pm UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/5 "2020-03-03T13:18:45Z")

</div>

> [@Wolfram\_Haussig](#):
>
> ly allows HTTPS connections. My configuration of the module(MetricBeat 7.6.0) is

could you post your jolokia conf ?  
thanks

---

<div class="post-metadata">

### Author: ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)
#### Post date: [March 3, 2020, 1:21pm UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/6 "2020-03-03T13:21:01Z")

</div>

Sure:  
# Module: jolokia  
# Docs: [https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-jolokia.html](https://www.elastic.co/guide/en/beats/metricbeat/7.6/metricbeat-module-jolokia.html)

```
- module: jolokia
  metricsets: ["jmx"]
  period: 10s
  hosts: ['https://myhost.mycompany.com:8443']
  namespace: "metrics"
  path: "/jolokia/?ignoreErrors=true&canonicalNaming=false"
  username: "metricbeat"
  password: "${tomcat.password}"
  ssl.certificate_authorities: ["/home/tomcat/metricbeat/intermediate.crt","/home/tomcat/metricbeat/root.crt"]
  jmx.mappings:
    - mbean: 'java.lang:type=Runtime'
      attributes:
        - attr: Uptime
          field: uptime
    - mbean: 'java.lang:type=Memory'
      attributes:
        - attr: HeapMemoryUsage
          field: memory.heap_usage
        - attr: NonHeapMemoryUsage
          field: memory.non_heap_usage
    # GC Metrics - this depends on what is available on your JVM
    - mbean: 'java.lang:type=GarbageCollector,name=ConcurrentMarkSweep'
      attributes:
        - attr: CollectionTime
          field: gc.cms_collection_time
        - attr: CollectionCount
          field: gc.cms_collection_count

  jmx.application:
  jmx.instance:
```

---

<div class="post-metadata">

### Author: ![seddikalaouiismaili](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seddikalaouiismaili/32/87834_2.png) [@seddikalaouiismaili](https://discuss.elastic.co/u/seddikalaouiismaili)
#### Post date: [March 3, 2020, 1:26pm UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/7 "2020-03-03T13:26:33Z")

</div>

many thanks man  
i have an issue for you, could you help me on it ??

> [@Metricbeat jolokia agent for tomcat application](https://discuss.elastic.co/t/metricbeat-jolokia-agent-for-tomcat-application/221852):
>
> Hello I'm contacting you about collecting metrics for a java tomcat application. We want to collect metrics for our application and we need to put it on the ELK stack for graphing !! here below many config : ==\> on my tomcat server : -- jolokia running on port 8778 -- jolokia.yml : module: jolokia metricsets: ["jmx"] hosts: ["localhost:8778"] period: 10s namespace: "jvm" jmx.mappings: mbean: "java.lang:type=Memory" attributes: attr: "HeapMemoryUsage" field: "memory.heap" attr:…

i'm using jolokia agent for tomcat's metrics !!  
i need some suggestions for my configurations if is it good or i need do butter than this !!

thanks

---

<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: [March 31, 2020, 1:26pm UTC](https://discuss.elastic.co/t/metricbeat-tomcat-module-with-https/220313/8 "2020-03-31T13:26:37Z")

</div>

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