Apache ZooKeeper Metrics
Collect and ship Apache ZooKeeper server metrics to Logstash and Elasticsearch.
Metricbeat is a lightweight shipper that helps you monitor your Apache ZooKeeper servers by collecting metrics running on the Apache ZooKeeper server. Configure Metricbeat using the pre-defined examples below to collect and ship Apache ZooKeeper service metrics and statistics to Logstash or Elasticsearch.
Step 1 - Install Metricbeat
First we need to install Metricbeat.
deb (Debian/Ubuntu)
sudo apt-get install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install metricbeat
rpm (Redhat/Centos)
sudo rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
echo "[elastic-6.x]
name=Elastic repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md" | sudo tee /etc/yum.repos.d/elastic-beats.repo
sudo yum install metricbeat
sudo chkconfig --add metricbeat
Step 2 - Locate configuration file
/etc/metricbeat/metricbeat.yml
Step 3 - Configure output
We'll be shipping to Logstash so that we have the option to run filters before the data is indexed.
Comment out the elasticsearch output block.
## Comment out elasticsearch output
#output.elasticsearch:
# hosts: ["localhost:9200"]
Uncomment and change the logstash output to match below.
output.logstash:
hosts: ["your-logstash-host:your-port"]
loadbalance: true
ssl.enabled: true
Step 4 - Enable module
There are several built in metricbeat modules you can use. To enable the Apache ZooKeeper module, run the following:
metricbeat modules list
metricbeat modules enable zookeeper
Step 5 - Configure module
Each module has its own configuration file where different metricsets can be enabled / disabled. Locate the configuration file for the Apache ZooKeeper module.
/etc/metricbeat/modules.d/zookeeper.yml
By default the following metricsets are disabled. To enable or disable a metric simply comment or uncomment the line out.
- module: zookeeper
# metricsets:
# - mntr
# - server
period: 10s
hosts: ["localhost:2181"]
Step 6 - Start Metricbeat
Ok, time to start gathering metrics!
sudo systemctl enable metricbeat
sudo systemctl start metricbeat
Step 7 - Compatability
The Apache ZooKeeper metricsets were tested with Apache ZooKeeper 3.4.8 and are expected to work with all versions >= 3.4.0. Versions prior to 3.4 do not support the mntr command.