# Cp rest proxy metrics

**URL:** <https://forum.confluent.io/t/cp-rest-proxy-metrics/4598>\
**Category:** Ops\
**Created:** [27 March 2022 20:54 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598 "2022-03-27T20:54:41Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [27 March 2022 20:54 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/1 "2022-03-27T20:54:41Z")

</div>

Hello forum,  
I am once again reching out 🙂

I have set up a rest proxy deployment on kubernetes which ia working as expected. Now i would like to retrieve some JMX metrics, so that i can feed them in to elasticsearch.  
However, i have been unable to dechipher how this is achieved.  
Basically i just want to enable the metrics, but i am unsure if the are actually enabled by default, or if i have to set some parameter in my deployment.  
And once they are enabled, do i then need to either mount in a jolokia jvm agent, or a prometheus jmx exporter?

Best regards  
Oelsner

---

<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:** [28 March 2022 05:29 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/2 "2022-03-28T05:29:16Z")

</div>

hi @Oelsner

welcome back 😉  
just to be sure:  
you like to get onl yrest proxy metrics or metrics from all your services deployed?  
how did you deploy your environment?  
using confluent helm charts or something else?

best,  
michael

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [28 March 2022 20:31 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/3 "2022-03-28T20:31:44Z")

</div>

Hi @mmuehlbeyer  
I would like to get just the metrics from rest proxy as described here [Monitoring REST Proxy | Confluent Documentation](https://docs.confluent.io/platform/current/kafka-rest/production-deployment/rest-proxy/monitoring.html). At least for now. Later on i would probably like to get metrics from other deployments.  
I created “read stole from left and right ideas”/inspired by this one [https://gitlab.com/atkozhuharov/kafka-rest-proxy-kubernetes/raw/master/kafka-proxy-deployment.yaml](https://gitlab.com/atkozhuharov/kafka-rest-proxy-kubernetes/raw/master/kafka-proxy-deployment.yaml)

The rest proxt is working just fine after a few minor changes to suit my needs. But i cant for the life of me figure out how to fetch those metrics. One suggestion i came across was this one [https://gitlab.com/atkozhuharov/kafka-rest-proxy-kubernetes/raw/master/kafka-proxy-deployment.yaml](https://gitlab.com/atkozhuharov/kafka-rest-proxy-kubernetes/raw/master/kafka-proxy-deployment.yaml)  
I therefore tried to add

```auto
env:
 - name: JMX_PORT
    value: "9011"

```

to the deployment in hopes that it would expose the metrics on that port as i had been informed that the afore mentioned metrics are exposed by default.

Any help on this is greatly appreaciated 🙂

Best regards  
Oelsner

---

<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:** [29 March 2022 05:17 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/4 "2022-03-29T05:17:59Z")

</div>

hi @Oelsner

ok I see.  
did you consider using the confluent rest proxy helm chart?

> **[cp-helm-charts/charts/cp-kafka-rest at master · confluentinc/cp-helm-charts](https://github.com/confluentinc/cp-helm-charts/tree/master/charts/cp-kafka-rest)**
>
> master/charts/cp-kafka-rest

whole jmx stuff is already in place there  
maybe you could use it as a template and adapt your conf 😉

best,  
michael

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [29 March 2022 08:31 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/5 "2022-03-29T08:31:15Z")

</div>

Hi @mmuehlbeyer  
I actually did not even consider it, but i just checked the link you gave me.  
It appears that it has a dependency to a running and accissible zookeeper ensemble, which i cant honor.  
This rest proxy i ment to work with confluent cloud, where is dont have any url’s to any zokeepers.  
I will try and see if i can find inspiration from the chart though and see if there are some things i can incorporate.

Cheers for now 🙂  
Oelsner

---

<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:** [29 March 2022 09:23 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/6 "2022-03-29T09:23:29Z")

</div>

hi @Oelsner

ah i see.  
according to your provides examples it maybe sufficient to add the prometheus exporter part and the port.

will test by myself and keep you posted 🙂

best,  
michael

---

<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:** [29 March 2022 13:34 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/7 "2022-03-29T13:34:31Z")

</div>

hi @Oelsner

short update.  
was able to connect my local test stack (docker-based) to my confluent cloud trial.  
converted the compose file with kompose to some kubernetes usable files.  
need to sanitize them 😉 could provide them afterwards, guess it might help

best,  
michael

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [29 March 2022 13:36 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/8 "2022-03-29T13:36:54Z")

</div>

Hi @mmuehlbeyer  
That sounds awesome!  
I would be very interested in seing them once sanitized 🙂

And thanks so much for taking your time to help with this.

Regards  
Oelsner

---

<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:** [29 March 2022 13:46 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/9 "2022-03-29T13:46:18Z")

</div>

Hi @Oelsner

you’re welcome

have a look at:

> **[kafka-ops/code\_snippets/cp-rest-proxy-kompose at master · mmuehlbeyer/kafka-ops](https://github.com/mmuehlbeyer/kafka-ops/tree/master/code_snippets/cp-rest-proxy-kompose)**
>
> master/code\_snippets/cp-rest-proxy-kompose

I guess not perfect maybe a good point to start with 🙂

best,  
michael

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [29 March 2022 20:56 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/10 "2022-03-29T20:56:24Z")

</div>

Hi @mmuehlbeyer  
Thanks so much for that. It looks interesting, and very different as to how i have created my own deployment 🙂 , i cant wait to try it out.  
I will report back here tomorrow in the evening with my findings… Now it is time to sleep 🙂

Once again for your time, i will keep you posted!

Best regards  
Oelsner

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [11 April 2022 20:44 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/11 "2022-04-11T20:44:00Z")

</div>

Hi @mmuehlbeyer  
Sorry about the latency.  
I was delegated to other tasks 😕  
Your provided solution deploys just fine, but i have been unable to connect to jmx.  
I will dig more into this d.uring the week. This week is easter holiday/playtime, so i can commit some time to it 🙂

I will let you know in a day or two how it goes!

Again, thanks so much for taking the time to help with this.

/Oelsner

---

<div class="post-metadata">

**Author:** ![Oelsner](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@Oelsner](https://forum.confluent.io/u/Oelsner)\
**Post date:** [22 April 2022 21:14 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/12 "2022-04-22T21:14:26Z")

</div>

@mmuehlbeyer  
I once again have to appologize for the latency.  
Tasks piled up, and product owner asked me to shift my attention to an immidiate delivery.  
However, your solution totally applies, but i still have to verify metrics availbility and such. Mind if i keep you posted?  
I have a deleviry deadline on wednessday for a service, which will keep me tied up until then.  
After that, i will revive this convo 🙂  
Again, your help is always much appreaciated!

Best regards  
Oelsner

---

<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:** [25 April 2022 05:36 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/13 "2022-04-25T05:36:42Z")

</div>

no worries 🙂

just keep me posted, I’m quite interested how everything is going

---

<div class="post-metadata">

**Author:** ![pkinuk](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@pkinuk](https://forum.confluent.io/u/pkinuk)\
**Post date:** [27 September 2024 14:06 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/14 "2024-09-27T14:06:47Z")

</div>

Hi @mmuehlbeyer, I’ve raised the similar in [How to enable the metrics in rest proxy](https://forum.confluent.io/t/how-to-enable-the-metrics-in-rest-proxy/11591) and then I came across this thread.

I’ve followed your suggestion in [github](https://github.com/mmuehlbeyer/kafka-ops/blob/d6195b5aaf1f66254b87a99891c1aa809744d1fe/code_snippets/cp-rest-proxy-kompose/rest-proxy-deployment.yaml), but I still can’t access the jmx/metric endpoint at port 1095

I use confluentinc/cp-kafka-rest:7.7.1 and it is also deployed to k8s cluster. Would you please help me get this fix? I’ve googled a lot but I couldn’t find any helpful suggestions.

Thanks

```auto
            - name: KAFKA_REST_JMX_OPTS
              value: -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1095 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.rmi.port=1095
            - name: KAFKA_REST_JMX_PORT
              value: "1095"

```

---

<div class="post-metadata">

**Author:** ![pkinuk](https://avatars.discourse-cdn.com/v4/letter/p/9e8a1a/32.png) [@pkinuk](https://forum.confluent.io/u/pkinuk)\
**Post date:** [27 September 2024 14:12 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/15 "2024-09-27T14:12:16Z")

</div>

I’ve tried to login the docker container and run curl localhost:1095, but nothing returned

```auto
curl localhost:1095
curl: (7) Failed to connect to localhost port 1095: Connection refused

```

---

<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:** [2 October 2024 06:32 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/16 "2024-10-02T06:32:52Z")

</div>

mmh did you use Confluent for Kubernetes to deploy the cluster?  
then jmx should be enabled by default

would you mind sharing your conf?

---

<div class="post-metadata">

**Author:** ![hifly81](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/hifly81/32/3552_2.png) [@hifly81](https://forum.confluent.io/u/hifly81)\
**Post date:** [2 October 2024 07:11 UTC](https://forum.confluent.io/t/cp-rest-proxy-metrics/4598/17 "2024-10-02T07:11:10Z")

</div>

@pkinuk why not working directly with a prometheus exporter? You can see an example in action at this link  
[jmx-monitoring-stacks/jmxexporter-prometheus-grafana/cfk at main · confluentinc/jmx-monitoring-stacks · GitHub](https://github.com/confluentinc/jmx-monitoring-stacks/tree/main/jmxexporter-prometheus-grafana/cfk) and this file [jmx-monitoring-stacks/jmxexporter-prometheus-grafana/cfk/demo/confluent-platform-singlenode.yaml at c521da7d167a048bd6a24fde4097a7ce864d8943 · confluentinc/jmx-monitoring-stacks · GitHub](https://github.com/confluentinc/jmx-monitoring-stacks/blob/c521da7d167a048bd6a24fde4097a7ce864d8943/jmxexporter-prometheus-grafana/cfk/demo/confluent-platform-singlenode.yaml)

You only need to add metrics for rest proxy pod
