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 + static_configs: + - targets: + - prometheus-jmx-exporter:5556 diff --git a/docker-compose.yml b/docker-compose.yml --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,6 +38,9 @@ prometheus: image: prom/prometheus + depends_on: + - prometheus-statsd-exporter + - prometheus-jmx-exporter command: # Needed for the reverse-proxy - "--web.external-url=/prometheus" @@ -54,9 +57,22 @@ - "./conf/prometheus-statsd-mapping.yml:/etc/prometheus/statsd-mapping.yml:ro" restart: unless-stopped + prometheus-jmx-exporter: + 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" + + grafana: image: grafana/grafana restart: unless-stopped + depends_on: + - prometheus environment: GF_SERVER_ROOT_URL: http://localhost:5080/grafana volumes: @@ -218,6 +234,7 @@ VERBOSITY: 3 DJANGO_SETTINGS_MODULE: swh.web.settings.development SWH_CONFIG_FILENAME: /web.yml + PYTHONUNBUFFERED: 1 entrypoint: /entrypoint.sh volumes: - "./conf/web.yml:/web.yml:ro"