MetricBeat tomcat module with HTTPS

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: 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

Hi @Wolfram_Haussig :slightly_smiling_face:

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 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 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.

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

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

Thanks for reporting!

could you post your jolokia conf ?
thanks

Sure:
# Module: jolokia
# Docs: 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:

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

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

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