使用Docker使用Prometheus监视Elassandra [英] Monitoring Elassandra with Prometheus using Docker

查看:121
本文介绍了使用Docker使用Prometheus监视Elassandra的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照我逐步完成了所有说明.这是我的docker-compose文件和conf/config.yml.

I did all the instructions step-by-step. Here is my docker-compose file and conf/config.yml.

docker-compose:

docker-compose:

version: '2'
services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    volumes:
      - /prometheus:/prometheus
      - ./conf/prome.yml:/etc/prometheus/prometheus.yml
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    ports:
      - '6009:9090'

  jmx-exporter:
    image: sscaling/jmx-prometheus-exporter
    container_name: jmx-exporter
    ports:
      - 6011:5556
    depends_on:
       - elassandra

  elassandra:
    image: strapdata/elassandra
    container_name: elassandra
    volumes:
      - /var/lib/cassandra:/var/lib/cassandra
    environment:
      - CASSANDRA_LISTEN_ADDRESS=localhost
      - CASSANDRA_RPC_ADDRESS=localhost
      - CASSANDRA_START_RPC=false
      - CASSANDRA_CLUSTER_NAME='DockerTest Cluster'
      - CASSANDRA_NUM_TOKENS=8
      - CASSANDRA#
      - LOCAL_JMX="no"
      - Dcassandra.jmx.remote.port="7199"
      - Dcom.sun.management.jmxremote.port="7199"
      - Dcom.sun.management.jmxremote.rmi.port="7199"
      - Dcom.sun.management.jmxremote.authenticate=false 

      - JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"
      - JMX_PORT="7199"
      - JVM_OPTS="$JVM_OPTS -Dcassandra.jmx.remote.port=5556"
      - JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=5556"
      - JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"

volumes:
        prometheus_data: {}
        elassandra_data: {}

conf/config.yml

startDelaySeconds: 0
hostPort: elassandra:7199
#username: 
#password: 
#jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:60/jmxrmi
ssl: false
lowercaseOutputName: false
lowercaseOutputLabelNames: false
whitelistObjectNames: ["org.apache.cassandra.metrics:*"]
blacklistObjectNames: ["org.apache.cassandra.metrics:type=ColumnFamily,*"]
rules:
  - pattern: 'org.apache.cassandra.metrics<type=(\w+), name=(\w+)><>Value: (\d+)'
    name: cassandra_$1_$2
    value: $3
    valueFactor: 0.001
    labels: {}
    help: "Cassandra metric $1 $2"
    type: GAUGE
    attrNameSnakeCase: false

无论何时运行docker-compose -f docker-compose.yml up,我都会面对localhost:6011上的以下页面:

whenever I run docker-compose -f docker-compose.yml up, I face with the following page on localhost:6011:

问题是我不知道如何使用jmx-exporter监视elassandra及其指标,我主要是获得Java指标!

The problem is that I don't know how to monitor elassandra and its metrics using jmx-exporter, I mainly get the java metrics!

推荐答案

在config.yml中,您使用的是hostPort: localhost:5556,但是您应该尝试连接到主机elassandra(您的docker容器的名称) docker-compose.yml文件).

In your config.yml you're using hostPort: localhost:5556 but you should try to connect to the host elassandra (the name of your docker container in your docker-compose.yml file).

确保已正确配置Elassandra以允许远程JMX连接.有关详细信息,请参见如何在Elassandra中启用远程JMX连接?如何设置.

Make sure Elassandra is configured properly to allow remote JMX connections. See How to enable remote JMX connections in Elassandra? for details how to set that up.

这篇关于使用Docker使用Prometheus监视Elassandra的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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