diff --git a/conf/cassandra.yaml b/conf/cassandra.yaml --- a/conf/cassandra.yaml +++ b/conf/cassandra.yaml @@ -427,7 +427,7 @@ parameters: # seeds is actually a comma-delimited list of addresses. # Ex: ",," - - seeds: "172.20.0.7" + - seeds: "172.20.0.8" # For workloads with more data than can fit in memory, Cassandra's # bottleneck will be reads that need to fetch data from @@ -601,7 +601,7 @@ # # Setting listen_address to 0.0.0.0 is always wrong. # -listen_address: 172.20.0.7 +listen_address: 172.20.0.8 # Set listen_address OR listen_interface, not both. Interfaces must correspond # to a single address, IP aliasing is not supported. @@ -615,7 +615,7 @@ # Address to broadcast to other Cassandra nodes # Leaving this blank will set it to the same value as listen_address -broadcast_address: 172.20.0.7 +broadcast_address: 172.20.0.8 # When using multiple physical network interfaces, set this # to true to listen on broadcast_address in addition to @@ -697,7 +697,7 @@ # be set to 0.0.0.0. If left blank, this will be set to the value of # rpc_address. If rpc_address is set to 0.0.0.0, broadcast_rpc_address must # be set. -broadcast_rpc_address: 172.20.0.7 +broadcast_rpc_address: 172.20.0.8 # enable or disable keepalive on rpc/native connections rpc_keepalive: true diff --git a/conf/prometheus-jmx-exporter-logging.properties b/conf/prometheus-jmx-exporter-logging.properties new file mode 100644 --- /dev/null +++ b/conf/prometheus-jmx-exporter-logging.properties @@ -0,0 +1,6 @@ +handlers=java.util.logging.ConsoleHandler +# uncomment this to get logs: +#java.util.logging.ConsoleHandler.level=ALL +#io.prometheus.jmx.level=ALL +#io.prometheus.jmx.shaded.io.prometheus.jmx.level=ALL + diff --git a/conf/prometheus-jmx-exporter.yml b/conf/prometheus-jmx-exporter.yml new file mode 100644 --- /dev/null +++ b/conf/prometheus-jmx-exporter.yml @@ -0,0 +1,42 @@ +# see: +# - http://cassandra.apache.org/doc/latest/operating/metrics.html +# - https://blog.pythian.com/step-step-monitoring-cassandra-prometheus-grafana/ + +startDelaySeconds: 0 +hostPort: cassandra-seed:7199 +username: +password: +#jmxUrl: service:jmx:rmi:///jndi/rmi://127.0.0.1:1234/jmxrmi +ssl: false +lowercaseOutputName: false +lowercaseOutputLabelNames: false +whitelistObjectNames: ["org.apache.cassandra.metrics:*"] +blacklistObjectNames: [] +rules: +- pattern: org.apache.cassandra.metrics<>(Count|Value) + name: cassandra_$1_$3 + labels: + address: "$2" +- pattern: org.apache.cassandra.metrics<>(Mean) + name: cassandra_$1_$2_$3 +- pattern: org.apache.cassandra.net<>(DownEndpointCount) + name: cassandra_$1_$2 +- pattern: org.apache.cassandra.metrics<>(Count|Mean|95thPercentile) + name: cassandra_$1_$3_$4 + labels: + "$1": "$2" +- pattern: org.apache.cassandra.metrics<>(Count|Mean|95thPercentile) + name: cassandra_$1_$4_$5 + labels: + "keyspace": "$2" + "table": "$3" +- pattern: org.apache.cassandra.metrics<>(Count|Mean|95thPercentile) + name: cassandra_$1_$3_$4 + labels: + "type": "$2" +- pattern: org.apache.cassandra.metrics<>(Count|Value) + name: cassandra_$1_$5 + labels: + "$1": "$4" + "$2": "$3" diff --git a/conf/prometheus.yml b/conf/prometheus.yml --- a/conf/prometheus.yml +++ b/conf/prometheus.yml @@ -15,3 +15,8 @@ static_configs: - targets: - prometheus-statsd-exporter:9102 + + - job_name: jmx-exporter-cassandra + static_configs: + - targets: + - prometheus-jmx-exporter-cassandra:5556 diff --git a/docker-compose.cassandra.yml b/docker-compose.cassandra.yml --- a/docker-compose.cassandra.yml +++ b/docker-compose.cassandra.yml @@ -24,6 +24,22 @@ env_file: - ./env/cassandra.env + prometheus: + # just to add the dep on the cassandra-jmx-exporter-cassandra + depends_on: + - prometheus-statsd-exporter + - prometheus-jmx-exporter-cassandra + + prometheus-jmx-exporter-cassandra: + image: sscaling/jmx-prometheus-exporter + environment: + JVM_OPTS: "-Djava.util.logging.config.file=/logging.properties" + volumes: + - "./conf/prometheus-jmx-exporter.yml:/opt/jmx_exporter/config.yml:ro" + - "./conf/prometheus-jmx-exporter-logging.properties:/logging.properties:ro" + ports: + - "5556:5556" + swh-storage: volumes: # note: you need to be on the cassandra-backend2 branch diff --git a/docker-compose.yml b/docker-compose.yml --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,8 @@ prometheus: image: prom/prometheus + depends_on: + - prometheus-statsd-exporter command: # Needed for the reverse-proxy - "--web.external-url=/prometheus" @@ -57,6 +59,8 @@ grafana: image: grafana/grafana restart: unless-stopped + depends_on: + - prometheus environment: GF_SERVER_ROOT_URL: http://localhost:5080/grafana volumes: