# Kafka Monitoring

**URL:** <https://forum.confluent.io/t/kafka-monitoring/5972>\
**Category:** Confluent Cloud\
**Created:** [7 September 2022 03:22 UTC](https://forum.confluent.io/t/kafka-monitoring/5972 "2022-09-07T03:22:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chiee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/chiee/32/2362_2.png) [@chiee](https://forum.confluent.io/u/chiee)\
**Post date:** [7 September 2022 03:22 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/1 "2022-09-07T03:22:29Z")

</div>

Hi All,

Can I setup monitoring jmx exporter for kafka confluent community license in aws ec2 instance?  
I have try for a few days but still failed in setup jmx exporter.

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [7 September 2022 05:30 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/2 "2022-09-07T05:30:59Z")

</div>

hey @chiee

yes you should be have a look at

> [@Kafka Monitoring and Metrics Using JMX](https://forum.confluent.io/t/kafka-monitoring-and-metrics-using-jmx/5807):
>
> Hi, Can I monitor Confluent Platform deployments by using Java Management Extensions (JMX) without Docker

did a small readme regarding prometheus (wip at the moment 😉 )

> <https://github.com/mmuehlbeyer/kafka-ops/tree/master/monitoring>
>
> //github.com/mmuehlbeyer/kafka-ops/tree/master/monitoring

best,  
michael

---

<div class="post-metadata">

**Author:** ![chiee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/chiee/32/2362_2.png) [@chiee](https://forum.confluent.io/u/chiee)\
**Post date:** [7 September 2022 05:50 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/3 "2022-09-07T05:50:35Z")

</div>

Hi @mmuehlbeyer ,

Thanks for answer my question,

I have look and follow that topic. but still getting error when start the kafka using  
EXTRA\_ARGS.  
should I’m install the kafka using TAR?  
because i have install kafka using YUM repositories.

best,  
chiee

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [7 September 2022 05:52 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/4 "2022-09-07T05:52:49Z")

</div>

Hi @chiee

should be working with yum installation as well.  
could you share some details?

how you’ve started the stack config and so on.

best,  
michael

---

<div class="post-metadata">

**Author:** ![chiee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/chiee/32/2362_2.png) [@chiee](https://forum.confluent.io/u/chiee)\
**Post date:** [7 September 2022 06:29 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/5 "2022-09-07T06:29:44Z")

</div>

Hi @mmuehlbeyer

I follow this article [https://mac-blog.org.ua/kafka-prometheus](https://mac-blog.org.ua/kafka-prometheus)

this command i used to started kafka.  
EXTRA\_ARGS=-javaagent:/root/kafka-jmx/jmx\_prometheus\_javaagent-0.16.1.jar=9102:/root/kafka-jmx/kafka\_broker.yml /bin/kafka-server-start /etc/kafka/server.properties

and get error this.  
ERROR [KafkaServer id=1001] Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)  
org.apache.kafka.common.KafkaException: Failed to acquire lock on file .lock in /var/lib/kafka2. A Kafka instance in another process or thread is using this directory.  
at kafka.log.LogManager.$anonfun$lockLogDirs$1(LogManager.scala:242)  
at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:118)  
at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:105)  
at scala.collection.mutable.ArraySeq.flatMap(ArraySeq.scala:37)  
at kafka.log.LogManager.lockLogDirs(LogManager.scala:237)  
at kafka.log.LogManager.(LogManager.scala:113)  
at kafka.log.LogManager$.apply(LogManager.scala:1319)  
at kafka.server.KafkaServer.startup(KafkaServer.scala:267)  
at kafka.Kafka$.main(Kafka.scala:109)  
at kafka.Kafka.main(Kafka.scala)

ERROR Exiting Kafka. (kafka.Kafka$)  
[2022-09-07 06:28:27,794] INFO [KafkaServer id=1001] shutting down (kafka.server.KafkaServer)

best,  
Chiee

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [7 September 2022 06:32 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/6 "2022-09-07T06:32:06Z")

</div>

hey @chiee

would you please check if there is another kafka process running  
according to your output

> [@chiee](#):
>
> org.apache.kafka.common.KafkaException: Failed to acquire lock on file .lock in /var/lib/kafka2. A Kafka instance in another process or thread is using this directory.

seems there is still something running

best  
michael

---

<div class="post-metadata">

**Author:** ![chiee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/chiee/32/2362_2.png) [@chiee](https://forum.confluent.io/u/chiee)\
**Post date:** [7 September 2022 06:37 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/7 "2022-09-07T06:37:09Z")

</div>

Hi @mmuehlbeyer,

yes, kafka has been running because it’s not fresh installation.  
so, i need stop kafka service first? or i need fresh installation to enable jmx exporter?

best,  
Chiee

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [7 September 2022 06:37 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/8 "2022-09-07T06:37:53Z")

</div>

Hi @chiee

you need to stop kafka and zookeeper first and then start both services again.

best,  
michael

---

<div class="post-metadata">

**Author:** ![chiee](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/chiee/32/2362_2.png) [@chiee](https://forum.confluent.io/u/chiee)\
**Post date:** [7 September 2022 07:04 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/9 "2022-09-07T07:04:16Z")

</div>

Hi, @mmuehlbeyer

amazing, it’s running now.  
Thank you for the advice michael.

best,  
Chiee

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/1X/c49438c90c9df282e9996fdf6971be890c71b65a.svg) [@system](https://forum.confluent.io/u/system)\
**Post date:** [14 September 2022 07:04 UTC](https://forum.confluent.io/t/kafka-monitoring/5972/10 "2022-09-14T07:04:38Z")

</div>

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