JMX 导出器和 Prometheus [英] JMX exporter and Prometheus

查看:73
本文介绍了JMX 导出器和 Prometheus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题是问题的延续

现在我在节点 x214 上运行单节点 kafka 代理,其报告指标使用端口 7071 上的 jmx 导出器

by now i have single node kafka broker running on node x214 and its reporting metrics using jmx exporter on port 7071

curl -s localhost:7071 | grep -i kafka
# reports many metrics on std out

我想将 jmx 导出器与 Prometheus 连接起来,并最终连接到 Grafana 进行可视化;如此处所述

i want to connect jmx exporter with Prometheus and eventually to grafana for visualization; as described here

我尝试按照博客的说明安装 Prometheus,但遇到了问题;我发现使用 docker 容器很容易启动 Prometheus

i tried installing Prometheus as blogs explains but running into issues; i find launching Prometheus easy with docker container as

docker run -p 9090:9090 -v /etc/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus

我在节点 x215(与 kafka 代理不同的节点)上运行 Prometheus.我可以通过 http://x215-ip:9090

I am running Prometheus on node x215 (different node than kafka broker). i can reach to Prometheus gui on http://x215-ip:9090

prometheus.yaml 文件设置如下.

prometheus.yaml file is set to following.

# my global config
global:
  scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus_master'
    scrape_interval: 5s
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['IP-215:9090']
  - job_name: ‘kafka-server’
    static_configs:
      - targets: [‘IP-214:7071’]

问题:-在 Prometheus gui 上我找不到任何 kafka 指标;响应上面的 curl 命令可见

Issue :- on Prometheus gui i cant find any kafka metrics; as visible in response of curl command above

指标页面 (IP-215:9090/metrics) 的响应是 这里

response of metrics page (IP-215:9090/metrics) is here

我觉得 JMX 导出器正在正确报告指标,但未正确连接到 Prometheus.你能帮我吗?

i feel that JMX exporter is reporting metrics correctly but its not connected to Prometheus correctly. can you help me here?

谢谢

推荐答案

我们需要更多信息来帮助确定这里发生了什么.您可以分享以下内容吗:

We need a little more information to help determine what's going on here. Can you share the following:

  • JMX 导出器的绑定接口(它是监听 0.0.0.0、127.0.0.1 还是其他一些特定接口?)这可以用类似 ss -plunt | 的东西来检查.grep -i jmx
  • prometheus 实例能否通过网络访问 JMX Exporter 实例?鉴于它们在不同的机器上,有很多事情可能会妨碍(防火墙、网络配置、SDN、IPtables……仅举几例).prometheus 容器确实有 telnet,因此最简单的方法是使用它来查看是否可以连接到端口 7071.docker exec -it prometheus sh 并运行 telnet IP-214:7071代码>.您也可以卷曲,但在普罗米修斯图像中卷曲不可用.
  • the bound interface for JMX exporter (is it listening on 0.0.0.0, 127.0.0.1, or some other specific interface?) This can be checked with something like ss -plunt | grep -i jmx
  • can the prometheus instance access the JMX Exporter instance over the network? Given that they're on different machines, there are numerous things that could come in the way (Firewalls, Network Configuration, SDN, IPtables... to name a few). The prometheus container does have telnet, so it's easiest to just use that to see if you can connect to port 7071. docker exec -it prometheus sh and run telnet IP-214:7071. You may also be able to curl, but curl is not available in the prometheus image.

同时检查这两项有助于排除配置中的一些简单问题.

Checking both of these can help rule out some simple problems in your configuration.

这篇关于JMX 导出器和 Prometheus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆