Skip to content

ZooKeeper

Auto-Detection
Health Check
Built-in Metrics

Bleemeo monitors Apache ZooKeeper through automatic service detection, health checks via the ruok command, and built-in metrics collection including JMX.

Glouton automatically detects ZooKeeper instances listening on port 2181.

The health check uses the ruok command. You may need to add it to 4lw.commands.whitelist in your ZooKeeper configuration. See the ZooKeeper documentation for details.

To enable JMX metrics, ZooKeeper must expose JMX over a TCP port and Glouton must be installed with JMX enabled. See Java Metrics for setup details.

To expose JMX:

  • If using Docker, add the environment variable JMXPORT=1234.
  • Otherwise, add -Dcom.sun.management.jmxremote.port=1234 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false to the JVM options (usually JAVA_OPTS in /etc/default/zookeeper).

If the auto-detected parameters are incorrect, you can override them manually.

Terminal window
sudo tee /etc/glouton/conf.d/99-zookeeper.conf > /dev/null << 'EOF'
service:
# For a ZooKeeper running outside a container
- type: "zookeeper"
address: "127.0.0.1"
port: 2181
jmx_port: "JMX_PORT"
jmx_username: "monitorRole" # by default, no authentication is done
jmx_password: "secret"
# For an additional ZooKeeper running outside a container
- type: "zookeeper"
instance: "NAME_ASSOCIATED_WITH_YOUR_ADDITIONAL_SERVICE"
address: "127.0.0.1"
port: 2182
jmx_port: "JMX_PORT"
jmx_username: "monitorRole" # by default, no authentication is done
jmx_password: "secret"
# For a ZooKeeper running in a Docker container
- type: "zookeeper"
instance: "CONTAINER_NAME"
address: "172.17.0.2"
port: 2181
jmx_port: "JMX_PORT"
jmx_username: "monitorRole" # by default, no authentication is done
jmx_password: "secret"
EOF

Glouton performs a health check using the ZooKeeper ruok command on port 2181.

Metric Description
service_status Status of ZooKeeper
Metric Description
zookeeper_connections Number of client connections to the ZooKeeper server
zookeeper_packets_received Number of packets received per second
zookeeper_packets_sent Number of packets sent per second
zookeeper_ephemerals_count Number of ephemeral nodes
zookeeper_watch_count Number of ZooKeeper watches
zookeeper_znode_count Number of znodes

The following metrics are gathered through JMX:

Metric Description
zookeeper_jvm_gc Number of garbage collections per second
zookeeper_jvm_gc_utilization Garbage collection utilization in percent
zookeeper_jvm_heap_used Heap memory used in bytes
zookeeper_jvm_non_heap_used Non-heap memory used in bytes