Grafana与Cassandra,Jolokia代理商问题

时间:2019-02-06 11:19:34

标签: docker cassandra grafana telegraf jolokia

我目前正在docker中运行我的Cassandra节点,并计划使用Grafana显示我的Cassandra节点的指标。

我正在使用本指南

https://andreastech.wordpress.com/2018/03/19/cassandra-performance-monitoring-by-using-jolokia-agent-telegraf-influxdb-and-grafana/

使用jolokia,influxdb和telegraf尝试在Grafana中显示图形。

但是,我无法启动Jolokia代理,并且似乎在连接时被拒绝。

以下是连接至jolokia时的错误。

Error in plugin: Get http://127.0.0.1:8778/jolokia/read/org.apache.cassandra.metrics:type=ColumnFamily,scope=%2A,%20name=AllMemtablesLiveDataSize,keyspace=%2A: dial tcp 127.0.0.1:8778: connect: connection refused

以下代码是我的cassandra节点的docker compose文件以及定义的指标。


docker-compose.yaml

grafana:
build:
  context: .
  dockerfile: InputOutputProgram/grafana/sawtooth-stats-grafana
  args:
    - http-proxy
    - https-proxy
    - no_proxy
depends_on:
  - influxdb
ports:
  - "3000:3000"
image: sawtooth-stats-grafana:latest
container_name: sawtooth-grafana

influxdb:
build:
  context: ./InputOutputProgram/influxdb
  dockerfile: sawtooth-stats-influxdb
  args:
    - http_proxy
    - https_proxy
    - no_proxy
ports:
  - "8086:8086"
volumes:
  - ./:/project/sawtooth-core
image: sawtooth-stats-influxdb:latest
container_name: sawtooth-influxdb

telegraf:
container_name: sawtooth-telegraf
image: telegraf:latest
volumes:
  - ./InputOutputProgram/telegraf.conf:/etc/telegraf/telegraf.conf
links:
  - influxdb
restart: always

cassandradb:
# image: cassandra:3.11.3
build:
  context: ./CassandraDB
  dockerfile: db/Dockerfile
container_name: cassandra-db
environment:
  CASSANDRA_BROADCAST_ADDRESS: "172.30.193.248"
ports:
  - "7000:7000"
  - "9042:9042"
  - "8778:8778"
expose:
  - 8778
# command: /bin/bash -c "sleep 1 && echo ' -- Pausing to let system catch up ... -->' && /docker-entrypoint.sh cassandra -f"
volumes:
  - "cassandra:/var/lib/cassandra"
  - "./CassandraDB/cassandra.yaml:/etc/cassandra/cassandra.yaml"
  - "./CassandraDB/cassandra-env.sh:/etc/cassandra/cassandra-env.sh"
  - "./CassandraDB/cassandra-init.sh:/cassandra-init.sh"
command: "sh /cassandra-init.sh"
links: 
  - "telegraf"
restart: always

telegraf.conf

#   ## List of servers exposing jolokia read service
[[inputs.jolokia.servers]]
name = "as-server-01"
host = "127.0.0.1"
port = "8778"
#     # username = "myuser"
#     # password = "mypassword"
#
#   ## List of metrics collected on above servers
#   ## Each metric consists in a name, a jmx path and either
#   ## a pass or drop slice attribute.
#   ## This collect all heap memory usage metrics. 
[[inputs.jolokia.metrics]]
name = "heap_memory_usage"
mbean  = "java.lang:type=Memory"
attribute = "HeapMemoryUsage"

# # Read Cassandra metrics through Jolokia
[[inputs.cassandra]]
#   # This is the context root used to compose the jolokia url
context = "/jolokia/read"
#   ## List of cassandra servers exposing jolokia read service
servers = ["127.0.0.1:8778"]
#   ## List of metrics collected on above servers
#   ## Each metric consists of a jmx path.
#   ## This will collect all heap memory usage metrics from the jvm and
#   ## ReadLatency metrics for all keyspaces and tables.
#   ## "type=Table" in the query works with Cassandra3.0. Older versions might
#   ## need to use "type=ColumnFamily"
metrics  = [
"/java.lang:type=Memory/HeapMemoryUsage",
"/java.lang:type=Memory/NonHeapMemoryUsage",
"/org.apache.cassandra.metrics:type=Storage,name=Load",
"/org.apache.cassandra.metrics:type=Storage,name=TotalHintsInProgress",
"/org.apache.cassandra.metrics:type=Storage,name=Exceptions",
"/org.apache.cassandra.metrics:type=ClientRequest,name=Latency,scope=*",
"/org.apache.cassandra.metrics:type=Client,name=connectedNativeClients",
"/org.apache.cassandra.metrics:type=CommitLog,name=PendingTasks",
"/org.apache.cassandra.metrics:type=CommitLog,name=TotalCommitLogSize",
"/org.apache.cassandra.metrics:type=ClientRequest,name=Timeouts,scope=*",
"/org.apache.cassandra.metrics:type=Compaction,name=BytesCompacted",
"/org.apache.cassandra.metrics:type=ColumnFamily,name=WriteLatency",
"/org.apache.cassandra.metrics:type=ColumnFamily,name=ReadLatency",
"/org.apache.cassandra.metrics:type=ColumnFamily,name=RangeLatency",
"/org.apache.cassandra.metrics:type=ColumnFamily,scope=*, name=AllMemtablesLiveDataSize,keyspace=*" 
]

Dockerfile

FROM cassandra:3.11.3

WORKDIR /source

COPY /jolokia-1.4.0/ ./

COPY PathJolokiaAgent.sh ./

RUN chmod u+x PathJolokiaAgent.sh

PathJolokiaAgent.sh

#!/usr/bin/env sh

echo "pathjolokia"

echo 'JVM_OPTS="$JVM_OPTS -javaagent:./jolokia-1.4.0/agents/jolokia-jvm.jar"' >> /etc/cassandra/cassandra-env.sh

向所有专家或设法使用docker在Grafana中显示Cassandra指标的任何人提供帮助。感谢所有帮助:)

0 个答案:

没有答案