# Zookeeper by HTTP ## Overview This template is designed for the effortless deployment of Zookeeper monitoring by Zabbix via HTTP and doesn't require any external scripts. ## Requirements Zabbix version: 7.0 and higher. ## Tested versions This template has been tested on: - Apache Zookeeper, version 3.6+, 3.8+ ## Configuration > Zabbix should be configured according to the instructions in the [Templates out of the box](https://www.zabbix.com/documentation/7.0/manual/config/templates_out_of_the_box) section. ## Setup This template works with standalone and cluster instances. Metrics are collected from each Zookeeper node by requests to [AdminServer](https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_adminserver). By default AdminServer is enabled and listens on port 8080. You can enable or configure AdminServer parameters according [official documentations](https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_adminserver_config). Don't forget to change macros {$ZOOKEEPER.COMMAND_URL}, {$ZOOKEEPER.PORT}, {$ZOOKEEPER.SCHEME}. ### Macros used |Name|Description|Default| |----|-----------|-------| |{$ZOOKEEPER.PORT}|

The port the embedded Jetty server listens on (admin.serverPort).

|`8080`| |{$ZOOKEEPER.COMMAND_URL}|

The URL for listing and issuing commands relative to the root URL (admin.commandURL).

|`commands`| |{$ZOOKEEPER.SCHEME}|

Request scheme which may be http or https

|`http`| |{$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}|

Maximum percentage of file descriptors usage alert threshold (for trigger expression).

|`85`| |{$ZOOKEEPER.OUTSTANDING_REQ.MAX.WARN}|

Maximum number of outstanding requests (for trigger expression).

|`10`| |{$ZOOKEEPER.PENDING_SYNCS.MAX.WARN}|

Maximum number of pending syncs from the followers (for trigger expression).

|`10`| ### Items |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Zookeeper: Get server metrics||HTTP agent|zookeeper.get_metrics| |Zookeeper: Get connections stats|

Get information on client connections to server. Note, depending on the number of client connections this operation may be expensive (i.e. impact server performance).

|HTTP agent|zookeeper.get_connections_stats| |Zookeeper: Server mode|

Mode of the server. In an ensemble, this may either be leader or follower. Otherwise, it is standalone

|Dependent item|zookeeper.server_state

**Preprocessing**

| |Zookeeper: Uptime|

Uptime that a peer has been in a table leading/following/observing state.

|Dependent item|zookeeper.uptime

**Preprocessing**

| |Zookeeper: Version|

Version of Zookeeper server.

|Dependent item|zookeeper.version

**Preprocessing**

| |Zookeeper: Approximate data size|

Data tree size in bytes.The size includes the znode path and its value.

|Dependent item|zookeeper.approximate_data_size

**Preprocessing**

| |Zookeeper: File descriptors, max|

Maximum number of file descriptors that a zookeeper server can open.

|Dependent item|zookeeper.max_file_descriptor_count

**Preprocessing**

| |Zookeeper: File descriptors, open|

Number of file descriptors that a zookeeper server has open.

|Dependent item|zookeeper.open_file_descriptor_count

**Preprocessing**

| |Zookeeper: Outstanding requests|

The number of queued requests when the server is under load and is receiving more sustained requests than it can process.

|Dependent item|zookeeper.outstanding_requests

**Preprocessing**

| |Zookeeper: Commit per sec|

The number of commits performed per second

|Dependent item|zookeeper.commit_count.rate

**Preprocessing**

| |Zookeeper: Diff syncs per sec|

Number of diff syncs performed per second

|Dependent item|zookeeper.diff_count.rate

**Preprocessing**

| |Zookeeper: Snap syncs per sec|

Number of snap syncs performed per second

|Dependent item|zookeeper.snap_count.rate

**Preprocessing**

| |Zookeeper: Looking per sec|

Rate of transitions into looking state.

|Dependent item|zookeeper.looking_count.rate

**Preprocessing**

| |Zookeeper: Alive connections|

Number of active clients connected to a zookeeper server.

|Dependent item|zookeeper.num_alive_connections

**Preprocessing**

| |Zookeeper: Global sessions|

Number of global sessions.

|Dependent item|zookeeper.global_sessions

**Preprocessing**

| |Zookeeper: Local sessions|

Number of local sessions.

|Dependent item|zookeeper.local_sessions

**Preprocessing**

| |Zookeeper: Drop connections per sec|

Rate of connection drops.

|Dependent item|zookeeper.connection_drop_count.rate

**Preprocessing**

| |Zookeeper: Rejected connections per sec|

Rate of connection rejected.

|Dependent item|zookeeper.connection_rejected.rate

**Preprocessing**

| |Zookeeper: Revalidate connections per sec|

Rate of connection revalidations.

|Dependent item|zookeeper.connection_revalidate_count.rate

**Preprocessing**

| |Zookeeper: Revalidate per sec|

Rate of revalidations.

|Dependent item|zookeeper.revalidate_count.rate

**Preprocessing**

| |Zookeeper: Latency, max|

The maximum amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.max_latency

**Preprocessing**

| |Zookeeper: Latency, min|

The minimum amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.min_latency

**Preprocessing**

| |Zookeeper: Latency, avg|

The average amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.avg_latency

**Preprocessing**

| |Zookeeper: Znode count|

The number of znodes in the ZooKeeper namespace (the data)

|Dependent item|zookeeper.znode_count

**Preprocessing**

| |Zookeeper: Ephemeral nodes count|

Number of ephemeral nodes that a zookeeper server has in its data tree.

|Dependent item|zookeeper.ephemerals_count

**Preprocessing**

| |Zookeeper: Watch count|

Number of watches currently set on the local ZooKeeper process.

|Dependent item|zookeeper.watch_count

**Preprocessing**

| |Zookeeper: Packets sent per sec|

The number of zookeeper packets sent from a server per second.

|Dependent item|zookeeper.packets_sent

**Preprocessing**

| |Zookeeper: Packets received per sec|

The number of zookeeper packets received by a server per second.

|Dependent item|zookeeper.packets_received.rate

**Preprocessing**

| |Zookeeper: Bytes received per sec|

Number of bytes received per second.

|Dependent item|zookeeper.bytes_received_count.rate

**Preprocessing**

| |Zookeeper: Election time, avg|

Time between entering and leaving election.

|Dependent item|zookeeper.avg_election_time

**Preprocessing**

| |Zookeeper: Elections|

Number of elections happened.

|Dependent item|zookeeper.cnt_election_time

**Preprocessing**

| |Zookeeper: Fsync time, avg|

Time to fsync transaction log.

|Dependent item|zookeeper.avg_fsynctime

**Preprocessing**

| |Zookeeper: Fsync|

Count of performed fsyncs.

|Dependent item|zookeeper.cnt_fsynctime

**Preprocessing**

| |Zookeeper: Snapshot write time, avg|

Average time to write a snapshot.

|Dependent item|zookeeper.avg_snapshottime

**Preprocessing**

| |Zookeeper: Snapshot writes|

Count of performed snapshot writes.

|Dependent item|zookeeper.cnt_snapshottime

**Preprocessing**

| ### Triggers |Name|Description|Expression|Severity|Dependencies and additional info| |----|-----------|----------|--------|--------------------------------| |Zookeeper: Server mode has changed|

Zookeeper node state has changed. Acknowledge to close the problem manually.

|`last(/Zookeeper by HTTP/zookeeper.server_state,#1)<>last(/Zookeeper by HTTP/zookeeper.server_state,#2) and length(last(/Zookeeper by HTTP/zookeeper.server_state))>0`|Info|**Manual close**: Yes| |Zookeeper: Failed to fetch info data|

Zabbix has not received data for items for the last 10 minutes

|`nodata(/Zookeeper by HTTP/zookeeper.uptime,10m)=1`|Warning|**Manual close**: Yes| |Zookeeper: Version has changed|

Zookeeper version has changed. Acknowledge to close the problem manually.

|`last(/Zookeeper by HTTP/zookeeper.version,#1)<>last(/Zookeeper by HTTP/zookeeper.version,#2) and length(last(/Zookeeper by HTTP/zookeeper.version))>0`|Info|**Manual close**: Yes| |Zookeeper: Too many file descriptors used|

Number of file descriptors used more than {$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}% of the available number of file descriptors.

|`min(/Zookeeper by HTTP/zookeeper.open_file_descriptor_count,5m) * 100 / last(/Zookeeper by HTTP/zookeeper.max_file_descriptor_count) > {$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}`|Warning|| |Zookeeper: Too many queued requests|

Number of queued requests in the server. This goes up when the server receives more requests than it can process.

|`min(/Zookeeper by HTTP/zookeeper.outstanding_requests,5m)>{$ZOOKEEPER.OUTSTANDING_REQ.MAX.WARN}`|Average|**Manual close**: Yes| ### LLD rule Leader metrics discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Leader metrics discovery|

Additional metrics for leader node

|Dependent item|zookeeper.metrics.leader

**Preprocessing**

| ### Item prototypes for Leader metrics discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Zookeeper: Pending syncs{#SINGLETON}|

Number of pending syncs to carry out to ZooKeeper ensemble followers.

|Dependent item|zookeeper.pending_syncs[{#SINGLETON}]

**Preprocessing**

| |Zookeeper: Quorum size{#SINGLETON}||Dependent item|zookeeper.quorum_size[{#SINGLETON}]

**Preprocessing**

| |Zookeeper: Synced followers{#SINGLETON}|

Number of synced followers reported when a node server_state is leader.

|Dependent item|zookeeper.synced_followers[{#SINGLETON}]

**Preprocessing**

| |Zookeeper: Synced non-voting follower{#SINGLETON}|

Number of synced voting followers reported when a node server_state is leader.

|Dependent item|zookeeper.synced_non_voting_followers[{#SINGLETON}]

**Preprocessing**

| |Zookeeper: Synced observers{#SINGLETON}|

Number of synced observers.

|Dependent item|zookeeper.synced_observers[{#SINGLETON}]

**Preprocessing**

| |Zookeeper: Learners{#SINGLETON}|

Number of learners.

|Dependent item|zookeeper.learners[{#SINGLETON}]

**Preprocessing**

| ### Trigger prototypes for Leader metrics discovery |Name|Description|Expression|Severity|Dependencies and additional info| |----|-----------|----------|--------|--------------------------------| |Zookeeper: Too many pending syncs||`min(/Zookeeper by HTTP/zookeeper.pending_syncs[{#SINGLETON}],5m)>{$ZOOKEEPER.PENDING_SYNCS.MAX.WARN}`|Average|**Manual close**: Yes| |Zookeeper: Too few active followers|

The number of followers should equal the total size of your ZooKeeper ensemble, minus 1 (the leader is not included in the follower count). If the ensemble fails to maintain quorum, all automatic failover features are suspended.

|`last(/Zookeeper by HTTP/zookeeper.synced_followers[{#SINGLETON}]) < last(/Zookeeper by HTTP/zookeeper.quorum_size[{#SINGLETON}])-1`|Average|| ### LLD rule Clients discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Clients discovery|

Get list of client connections.

Note, depending on the number of client connections this operation may be expensive (i.e. impact server performance).

|HTTP agent|zookeeper.clients

**Preprocessing**

| ### Item prototypes for Clients discovery |Name|Description|Type|Key and additional info| |----|-----------|----|-----------------------| |Zookeeper client {#TYPE} [{#CLIENT}]: Get client info|

The item gets information about "{#CLIENT}" client of "{#TYPE}" type.

|Dependent item|zookeeper.client_info[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Latency, max|

The maximum amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.max_latency[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Latency, min|

The minimum amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.min_latency[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Latency, avg|

The average amount of time it takes for the server to respond to a client request.

|Dependent item|zookeeper.avg_latency[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Packets sent per sec|

The number of packets sent.

|Dependent item|zookeeper.packets_sent[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Packets received per sec|

The number of packets received.

|Dependent item|zookeeper.packets_received[{#TYPE},{#CLIENT}]

**Preprocessing**

| |Zookeeper client {#TYPE} [{#CLIENT}]: Outstanding requests|

The number of queued requests when the server is under load and is receiving more sustained requests than it can process.

|Dependent item|zookeeper.outstanding_requests[{#TYPE},{#CLIENT}]

**Preprocessing**

| ## Feedback Please report any issues with the template at [`https://support.zabbix.com`](https://support.zabbix.com) You can also provide feedback, discuss the template, or ask for help at [`ZABBIX forums`](https://www.zabbix.com/forum/zabbix-suggestions-and-feedback)