【问题标题】:How to connect Prometheus with Presto JMX如何将 Prometheus 与 Presto JMX 连接起来
【发布时间】:2019-08-10 05:22:56
【问题描述】:
【问题讨论】:
标签:
jmx
prometheus
presto
jmx-exporter
【解决方案1】:
#1 从源代码构建
你需要自己构建go代码
#2 Docker(推荐)
例如,ip 使用内部网络 ip 以便 docker 容器可以访问它。
# docker run --rm yahoojapan/presto-exporter:master --help
# for more infomation
docker run --rm -p 9483:9483 yahoojapan/presto-exporter:master --web.url="http://<ip>:8080/v1/cluster"
然后在Prometheus
scrape_configs:
# other configurations...
- job_name: 'presto_exporter'
static_configs:
- targets: ['<server_ip_that_run_docker_command>:9483']
重启Prometheus
查询presto_*或导入此仪表板:https://grafana.com/grafana/dashboards/10866
更新
还有更多不是以presto_开头的指标,见:http://<server_ip_that_run_docker_command>:9483/metrics
【解决方案2】:
没有 Docker,没有 presto-exporter docker 容器
Prometheus 监控也可以在 presto jvm.config 文件中启用 JMX 选项
-server
-Xmx3G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=9015
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-javaagent:/opt/java_metrics/jmx_prometheus_javaagent-0.3.0.jar=9483:/opt/java_metrics/config.yml
在prometheus.yml文件中为presto添加Prometheus抓取点
scrape_configs:
- job_name: presto
static_configs:
- targets: ['<presto_ip>:9483']
- Presto 指标将在
http://<presto_ip>:9483/metrics 上提供