radiantone/zk-exporter

By radiantone

Updated about 6 hours ago

Image
0

10K+

radiantone/zk-exporter repository overview

zk-exporter

Exports mntr zookeeper's stats in prometheus format. zk_followers, zk_synced_followers and zk_pending_syncs metrics are available only on cluster leader.

Build

./build.sh script builds dabealu/zookeeper-exporter:latest docker image. To build image with different name, pass it to build.sh as a first arg.

Usage
echo "4lw.commands.whitelist=mntr" >> rli-zookeeper-external/zookeeper/conf/zoo.cfg;rli-zookeeper-external/bin/stop_zookeeper.sh;rli-zookeeper-external/bin/start_zookeeper.sh;

Note: starting from zookeeper v3.4.10 it's required to have mntr command whitelisted (details: 4lw.commands.whitelist).

Warning: flag to specify target zk hosts is changed since v0.1.10, see below

Usage of zookeeper-exporter:
  -listen string
        address to listen on (default "0.0.0.0:9141")
  -location string
        metrics location (default "/metrics")
  -timeout int
        timeout for connection to zk servers, in seconds (default 30)
  -zk-hosts string
        comma separated list of zk servers, e.g. '10.0.0.1:2181,10.0.0.2:2181,10.0.0.3:2181'
  -zk-tls-auth bool
        zk tls client authentication (default false)
  -zk-tls-auth-cert string
        tls certiticate for zk tls client authentication (required if -zk-tls-auth is true)
  -zk-tls-auth-key string
        tls key for zk tls client authentication (required if -zk-tls-auth is true)

An example docker-compose.yml can be used for management of clustered zookeeper + exporters:

# start zk cluster and exporters
docker-compose up -d

# shutdown containers
docker-compose down -v
Dashboard

Example grafana dashboard: https://grafana.com/grafana/dashboards/11442

Environmental variables

VARIABLEDEFAULT VALUEDESCRIPTION
ZK_CONN-(Required to start metrics server else metrics server is not started) Zookeeper node connection string to pull metrics from
FLUENTD_ENABLE-To enable log streaming with fluentd
FLUENTD_CONF-(Required) Always make sure conf file is mounted at this location /fluentd/etc/fluent.conf
ELASTICSEARCH_HOST-(Required to start stream logs to elasticsearch else will not server metrics)
ELASTICSEARCH_PORT9200Elasticsearch port
PUSH_MODEfalseTo enable push mode set the value to true
PUSHGATEWAY_URI-Prometheus pushgateway endpoint (http://pushgateway:9091)
PUSH_METRICS_CRON* * * * *CRON expression at what interval push has to take place
JOB_NAMEfid-targetsName of the scrape job to be set during push
INSTANCE_NAME$HOSTNAMEName of the instance to be set during push

Metrics are served at 9095 port with route /metrics Log file has to be present at this location for zkexporter container to stream logs /opt/radiantone/rli-zookeeper-external/zookeeper/logs/zookeeper.log

docker-compose usage

For metrics only

zkexp-0:
    image: radiantone/zk-exporter
    hostname: "zkexp-0"
    privileged: true
    environment:
      ZK_CONN: "zk-0:2181"
    ports:
      - 9095:9095
    volumes:
      - zk-0:/opt/radiantone
    networks:
      zk-net:
        aliases:
          - zkexp-0

For metrics and fluentd w/ elasticsearch default config

zkexp-0:
    image: radiantone/zk-exporter
    hostname: "zkexp-0"
    privileged: true
    environment:
      ZK_CONN: "zk-0:2181"
      FLUENTD_ENABLE: "true"
      FLUENTD_CONF: "/fluentd/etc/fluent.conf"
      ELASTICSEARCH_HOST: "elasticsearch"
      ELASTICSEARCH_PORT: "9200"
    ports:
      - 9095:9095
    volumes:
      - zk-0:/opt/radiantone
    networks:
      zk-net:
        aliases:
          - zkexp-0

For metrics and fluentd w/ elasticsearch custom config

zkexp-0:
    image: radiantone/zk-exporter
    hostname: "zkexp-0"
    privileged: true
    environment:
      ZK_CONN: "zk-0:2181"
      FLUENTD_ENABLE: "true"
      FLUENTD_CONF: "/fluentd/etc/fluent.conf"
    ports:
      - 9095:9095
    volumes:
      - zk-0:/opt/radiantone
      - ./fluent.conf:/fluentd/etc/fluent.conf
    networks:
      zk-net:
        aliases:
          - zkexp-0

For push metrics and fluentd elasticsearch default config

  zkexp-0:
    container_name: "zkexp-0"
    build: .
    hostname: "zkexp-0"
    privileged: true
    environment:
      PUSH_MODE: "true"
      PUSHGATEWAY_URI: "http://pushgateway:9091"
      ZK_CONN: "zk-0:2181"
      FLUENTD_ENABLE: "true"
      FLUENTD_CONF: "/fluentd/etc/fluent.conf"
      ELASTICSEARCH_HOST: "elasticsearch"
      ELASTICSEARCH_PORT: "9200"

Tag summary

Content type

Image

Digest

sha256:a7f423a4c

Size

184.8 MB

Last updated

about 2 months ago

docker pull radiantone/zk-exporter