# Cannot connect metricbeat with an SSL secured Kafka

**URL:** <https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 14, 2020, 2:35pm UTC](https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060 "2020-10-14T14:35:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JadeJaber](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@JadeJaber](https://discuss.elastic.co/u/JadeJaber)\
**Post date:** [October 14, 2020, 2:35pm UTC](https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060/1 "2020-10-14T14:35:13Z")

</div>

Hi,

I have set the following configuration on my Kafka Module

```auto
- module: kafka
  metricsets:
    - partition
    - consumergroup
  period: 10s
  hosts: ["centralfeederkafka01.datalakefeeder###.com:9093"]
  ssl.enabled: true
  ssl.certificate_authorities: ["/usr/hadoop/kafka/config/cert2.truststore"]
  ssl.verification_mode: none
  ssl.certificate: "/usr/hadoop/kafka/config/cert2.pem"
  ssl.key: "/usr/hadoop/kafka/config/cert2.key"

```

And my certificate chain works

```auto
kafka@centralfeederkafka03:/usr/hadoop/metricbeat$ openssl s_client -connect centralfeederkafka01.datalakefeeder.###.com:9093 -key /usr/hadoop/kafka/config/cert2.key -cert /usr/hadoop/kafka/config/cert2.pem -CAfile /usr/hadoop/kafka/config/cert2.truststore
    …
    SSL handshake has read 16671 bytes and written 4664 bytes

    Verification: OK

```

And here is my Kafka listeners:

```auto
listeners=SSL://centralfeederkafka01.datalakefeeder.###.com:9093,PLAINTEXT://centralfeederkafka01.datalakefeeder.###.com:9092
advertised.listeners=SSL://centralfeederkafka01.datalakefeeder.###.com:9093

```

And here is my current error :

```auto
INFO module/wrapper.go:259 Error fetching data for metricset kafka.partition: error in connect: Could not get cluster client for advertised broker with address centralfeederkafka01.datalakefeeder.###.com:9093

```

**Please note that it is perfectly working on port 9092 with PLAINTEXT**

---

<div class="post-metadata">

**Author:** ![mtojek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mtojek/32/63863_2.png) [@mtojek](https://discuss.elastic.co/u/mtojek)\
**Post date:** [October 15, 2020, 9:07am UTC](https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060/2 "2020-10-15T09:07:05Z")

</div>

Did you try to enable the debug mode and check if there are potential errors in logs?

---

<div class="post-metadata">

**Author:** ![JadeJaber](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@JadeJaber](https://discuss.elastic.co/u/JadeJaber)\
**Post date:** [October 15, 2020, 11:48am UTC](https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060/3 "2020-10-15T11:48:25Z")

</div>

> [@JadeJaber](#):
>
> `error in connect: Could not get cluster client for advertised broker with address `

I have just fixed my issue. Actually the certificate should NOT be a wildcard one.

---

<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:** [November 12, 2020, 1:48pm UTC](https://discuss.elastic.co/t/cannot-connect-metricbeat-with-an-ssl-secured-kafka/252060/4 "2020-11-12T13:48:33Z")

</div>

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