zabbix_export:
  version: '7.0'
  template_groups:
    - uuid: a571c0d144b14fd4a87a9d9b2aa9fcd6
      name: Templates/Applications
  templates:
    - uuid: b606eda347ea4663a33ad4d12a482750
      template: 'Zookeeper by HTTP'
      name: 'Zookeeper by HTTP'
      description: |
        This template is designed for the effortless deployment of Apache Zookeeper monitoring by Zabbix via HTTP and doesn't require any external scripts.
        
        This template works with standalone and cluster instances. Metrics are collected from each Zookeeper node by requests to AdminServer
        
        Setup:
        
        1. Enable the AdminServer and configure the parameters according to the official documentation:
        https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_adminserver_config
        
        2. Set the hostname or IP address of the Apache Zookeeper host in the '{$ZOOKEEPER.HOST}' macro. You can also change the '{$ZOOKEEPER.COMMAND_URL}', '{$ZOOKEEPER.PORT}' and '{$ZOOKEEPER.SCHEME}' macros if necessary.
        
        You can discuss this template or leave feedback on our forum:
        https://www.zabbix.com/forum/zabbix-suggestions-and-feedback
        
        Generated by official Zabbix template tool "Templator"
      vendor:
        name: Zabbix
        version: 7.0-0
      groups:
        - name: Templates/Applications
      items:
        - uuid: c7e7e728371a45ef81c35929a713ab4a
          name: 'Approximate data size'
          type: DEPENDENT
          key: zookeeper.approximate_data_size
          units: B
          description: 'Data tree size in bytes.The size includes the znode path and its value.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.approximate_data_size
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: disk
        - uuid: 260f60267bda40099f323292d7f0b8fd
          name: 'Election time, avg'
          type: DEPENDENT
          key: zookeeper.avg_election_time
          value_type: FLOAT
          units: ms
          description: 'Time between entering and leaving election.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value),
                  	res = metrics.avg_election_time || metrics['election_time{quantile="0.5"}'];
                  if (isNaN(res)) {
                  	return 0;
                  }
                  return res;
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
        - uuid: 28aa45a47df64503a9553a05794f512a
          name: 'Fsync time, avg'
          type: DEPENDENT
          key: zookeeper.avg_fsynctime
          value_type: FLOAT
          units: ms
          description: 'Time to fsync transaction log.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value),
                  	res = metrics.avg_fsynctime || metrics['fsynctime{quantile="0.5"}'];
                  if (isNaN(res)) {
                  	return 0;
                  }
                  return res;
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: disk
        - uuid: 243ea1e324d5464a88c8847e721cd38b
          name: 'Latency, avg'
          type: DEPENDENT
          key: zookeeper.avg_latency
          value_type: FLOAT
          units: ms
          description: 'The average amount of time it takes for the server to respond to a client request.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.avg_latency
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: requests
        - uuid: 6195a64eb23341f0964d8d9ffbf9e624
          name: 'Snapshot write time, avg'
          type: DEPENDENT
          key: zookeeper.avg_snapshottime
          value_type: FLOAT
          units: ms
          description: 'Average time to write a snapshot.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value),
                  	res = metrics['snapshottime{quantile="0.5"}'] || metrics.avg_snapshottime ;
                  if (isNaN(res)) {
                  	return 0;
                  }
                  return res;
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: disk
        - uuid: f227c61a498f47f6ba1862a741da3789
          name: 'Bytes received per sec'
          type: DEPENDENT
          key: zookeeper.bytes_received_count.rate
          value_type: FLOAT
          units: Bps
          description: 'Number of bytes received per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.bytes_received_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: network
        - uuid: b9a97ebbaf7d416998e24553cee3559c
          name: Elections
          type: DEPENDENT
          key: zookeeper.cnt_election_time
          description: 'Number of elections happened.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value);
                  if (metrics.server_state === "standalone") {
                  	return 0
                  	}
                  else {
                  	return metrics.cnt_election_time || metrics.election_time_count
                  }
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
        - uuid: 01d490987f954950b7ce3a107aefa200
          name: Fsync
          type: DEPENDENT
          key: zookeeper.cnt_fsynctime
          description: 'Count of performed fsyncs.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value)
                  return metrics.cnt_fsynctime || metrics.fsynctime_count
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: disk
        - uuid: 159bf1c1f29846a582e201c143239182
          name: 'Snapshot writes'
          type: DEPENDENT
          key: zookeeper.cnt_snapshottime
          description: 'Count of performed snapshot writes.'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var metrics = JSON.parse(value)
                  return metrics.snapshottime_count || metrics.cnt_snapshottime
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: disk
        - uuid: 10b17f0682c44e2391b8ee191ed355c1
          name: 'Commit per sec'
          type: DEPENDENT
          key: zookeeper.commit_count.rate
          value_type: FLOAT
          description: 'The number of commits performed per second'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.commit_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: operations
        - uuid: 1c0ff2c8d4844ed4b815f2a793dd6e7b
          name: 'Drop connections per sec'
          type: DEPENDENT
          key: zookeeper.connection_drop_count.rate
          value_type: FLOAT
          description: 'Rate of connection drops.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.connection_drop_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: connections
        - uuid: 640195274cda47ed83faa4f0c6529818
          name: 'Rejected connections per sec'
          type: DEPENDENT
          key: zookeeper.connection_rejected.rate
          value_type: FLOAT
          description: 'Rate of connection rejected.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.connection_rejected
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: connections
        - uuid: 1498099b44d3424093f7cea55cb256e8
          name: 'Revalidate connections per sec'
          type: DEPENDENT
          key: zookeeper.connection_revalidate_count.rate
          value_type: FLOAT
          description: 'Rate of connection revalidations.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.connection_revalidate_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: connections
        - uuid: 3e8e3bc9910e4c3c898e1371790a35f0
          name: 'Diff syncs per sec'
          type: DEPENDENT
          key: zookeeper.diff_count.rate
          value_type: FLOAT
          description: 'Number of diff syncs performed per second'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.diff_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: operations
        - uuid: 1a581bf18a364868b6eb47bbafcaa105
          name: 'Ephemeral nodes count'
          type: DEPENDENT
          key: zookeeper.ephemerals_count
          description: 'Number of ephemeral nodes that a zookeeper server has in its data tree.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.ephemerals_count
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
        - uuid: f682f5d6e1664f919872f309371e4079
          name: 'Get connections stats'
          type: HTTP_AGENT
          key: zookeeper.get_connections_stats
          history: '0'
          value_type: TEXT
          description: '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).'
          url: '{$ZOOKEEPER.SCHEME}://{$ZOOKEEPER.HOST}:{$ZOOKEEPER.PORT}/{$ZOOKEEPER.COMMAND_URL}/connections'
          tags:
            - tag: component
              value: connections
            - tag: component
              value: raw
        - uuid: cf7e83297d6343fb87dcd7848f62ce41
          name: 'Get server metrics'
          type: HTTP_AGENT
          key: zookeeper.get_metrics
          history: '0'
          value_type: TEXT
          url: '{$ZOOKEEPER.SCHEME}://{$ZOOKEEPER.HOST}:{$ZOOKEEPER.PORT}/{$ZOOKEEPER.COMMAND_URL}/monitor'
          tags:
            - tag: component
              value: raw
        - uuid: 0f8e7ac6f753483d86744b2ab6aa28dd
          name: 'Global sessions'
          type: DEPENDENT
          key: zookeeper.global_sessions
          description: 'Number of global sessions.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.global_sessions
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: sessions
        - uuid: 72519325755b4c27931c674756313ebb
          name: 'Local sessions'
          type: DEPENDENT
          key: zookeeper.local_sessions
          description: 'Number of local sessions.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.local_sessions
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: sessions
        - uuid: 8a784676586d4b719a0b5c1327a0645f
          name: 'Looking per sec'
          type: DEPENDENT
          key: zookeeper.looking_count.rate
          value_type: FLOAT
          description: 'Rate of transitions into looking state.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.looking_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: operations
        - uuid: 350a5b566e054e8390bb43ce0b2916c6
          name: 'File descriptors, max'
          type: DEPENDENT
          key: zookeeper.max_file_descriptor_count
          description: 'Maximum number of file descriptors that a zookeeper server can open.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.max_file_descriptor_count
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 185f5c3fdfde43afa55ed4c38c0878dc
          name: 'Latency, max'
          type: DEPENDENT
          key: zookeeper.max_latency
          value_type: FLOAT
          units: ms
          description: 'The maximum amount of time it takes for the server to respond to a client request.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.max_latency
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: requests
        - uuid: a4b3d6d9cfb14454b83475b89fe44e06
          name: 'Latency, min'
          type: DEPENDENT
          key: zookeeper.min_latency
          value_type: FLOAT
          units: ms
          description: 'The minimum amount of time it takes for the server to respond to a client request.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.min_latency
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: requests
        - uuid: 86ba6a7967e8462cb6ff4be126e21a44
          name: 'Alive connections'
          type: DEPENDENT
          key: zookeeper.num_alive_connections
          description: 'Number of active clients connected to a zookeeper server.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.num_alive_connections
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: connections
        - uuid: e441c926d2f947708b39d7615520405d
          name: 'File descriptors, open'
          type: DEPENDENT
          key: zookeeper.open_file_descriptor_count
          description: 'Number of file descriptors that a zookeeper server has open.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.open_file_descriptor_count
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: fds
        - uuid: 88ede9687323440183d665d38938212e
          name: 'Outstanding requests'
          type: DEPENDENT
          key: zookeeper.outstanding_requests
          description: 'The number of queued requests when the server is under load and is receiving more sustained requests than it can process.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.outstanding_requests
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: requests
          triggers:
            - uuid: ac27f2d8b34546d1bdc6d7ab858c04a1
              expression: 'min(/Zookeeper by HTTP/zookeeper.outstanding_requests,5m)>{$ZOOKEEPER.OUTSTANDING_REQ.MAX.WARN}'
              name: 'Too many queued requests'
              event_name: 'Too many queued requests (over {$ZOOKEEPER.OUTSTANDING_REQ.MAX.WARN}% for 5 min)'
              priority: AVERAGE
              description: 'Number of queued requests in the server. This goes up when the server receives more requests than it can process.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: performance
        - uuid: 3295ed3fdb504014b351eba81bf55ccf
          name: 'Packets received per sec'
          type: DEPENDENT
          key: zookeeper.packets_received.rate
          value_type: FLOAT
          description: 'The number of zookeeper packets received by a server per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.packets_received
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: network
        - uuid: ecef658cb34247e2838e0f7313dba0bf
          name: 'Packets sent per sec'
          type: DEPENDENT
          key: zookeeper.packets_sent
          value_type: FLOAT
          description: 'The number of zookeeper packets sent from a server per second.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.packets_sent
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: network
        - uuid: 8295b8c4c1f44ba48987f36b54b43ab8
          name: 'Revalidate per sec'
          type: DEPENDENT
          key: zookeeper.revalidate_count.rate
          value_type: FLOAT
          description: 'Rate of revalidations.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.revalidate_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: operations
        - uuid: 44a1f40fb3604fcda9fedc4beeb87baf
          name: 'Server mode'
          type: DEPENDENT
          key: zookeeper.server_state
          value_type: CHAR
          description: 'Mode of the server. In an ensemble, this may either be leader or follower. Otherwise, it is standalone'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.server_state
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 494624353875401eaf65f7eb0273ca35
              expression: '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'
              name: 'Server mode has changed'
              event_name: 'Server mode has changed (new mode: {ITEM.VALUE})'
              priority: INFO
              description: 'Zookeeper node state has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: d143981fdaee4c51bcbb773579be25f0
          name: 'Snap syncs per sec'
          type: DEPENDENT
          key: zookeeper.snap_count.rate
          value_type: FLOAT
          description: 'Number of snap syncs performed per second'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.snap_count
            - type: CHANGE_PER_SECOND
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: operations
        - uuid: cea535cfb32940f29aee3c17734e8c51
          name: Uptime
          type: DEPENDENT
          key: zookeeper.uptime
          units: s
          description: 'Uptime that a peer has been in a table leading/following/observing state.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.uptime
            - type: MULTIPLIER
              parameters:
                - '0.001'
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: db35b5c75fc543ef8ffe766a0671fd6d
              expression: 'nodata(/Zookeeper by HTTP/zookeeper.uptime,10m)=1'
              name: 'Failed to fetch info data'
              event_name: 'Failed to fetch info data (or no data for 10m)'
              priority: WARNING
              description: 'Zabbix has not received data for items for the last 10 minutes'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: availability
        - uuid: 86a65edd19e14fa9aea1ff40220f895c
          name: Version
          type: DEPENDENT
          key: zookeeper.version
          value_type: CHAR
          description: 'Version of Zookeeper server.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.version
            - type: REGEX
              parameters:
                - '^([0-9\.]+)'
                - \1
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 3h
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
          triggers:
            - uuid: 2a091bcfafe84ea9aee5238ce5e25651
              expression: 'last(/Zookeeper by HTTP/zookeeper.version,#1)<>last(/Zookeeper by HTTP/zookeeper.version,#2) and length(last(/Zookeeper by HTTP/zookeeper.version))>0'
              name: 'Version has changed'
              event_name: 'Version has changed (new version: {ITEM.VALUE})'
              priority: INFO
              description: 'Zookeeper version has changed. Acknowledge to close the problem manually.'
              manual_close: 'YES'
              tags:
                - tag: scope
                  value: notice
        - uuid: 5cbc4414c19146ff87e15f21c77808c9
          name: 'Watch count'
          type: DEPENDENT
          key: zookeeper.watch_count
          description: 'Number of watches currently set on the local ZooKeeper process.'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.watch_count
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
        - uuid: 07925b71e3fe421eac9b338fc23713d0
          name: 'Znode count'
          type: DEPENDENT
          key: zookeeper.znode_count
          description: 'The number of znodes in the ZooKeeper namespace (the data)'
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.znode_count
            - type: DISCARD_UNCHANGED_HEARTBEAT
              parameters:
                - 1h
          master_item:
            key: zookeeper.get_metrics
          tags:
            - tag: component
              value: application
      discovery_rules:
        - uuid: e0f576ea5ae44289866fb726079ddbf8
          name: 'Clients discovery'
          type: HTTP_AGENT
          key: zookeeper.clients
          delay: 1h
          description: |
            Get list of client connections.
            Note, depending on the number of client connections this operation may be expensive (i.e. impact server performance).
          item_prototypes:
            - uuid: b5a378d3785542dca169b1bc1c02189f
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Latency, avg'
              type: DEPENDENT
              key: 'zookeeper.avg_latency[{#TYPE},{#CLIENT}]'
              value_type: FLOAT
              units: ms
              description: 'The average amount of time it takes for the server to respond to a client request.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.avg_latency
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: requests
                - tag: type
                  value: '{#TYPE}'
            - uuid: 76f3b4f0a73d4565bdb5391ac9af9f24
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Get client info'
              type: DEPENDENT
              key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              history: '0'
              value_type: TEXT
              description: 'The item gets information about "{#CLIENT}" client of "{#TYPE}" type.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - '$.{#TYPE}.[?(@.remote_socket_address == "{#ADDRESS}")].first()'
                  error_handler: DISCARD_VALUE
              master_item:
                key: zookeeper.get_connections_stats
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: raw
                - tag: type
                  value: '{#TYPE}'
            - uuid: 2a36ecfb56754bcb8bdc91da76316fb4
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Latency, max'
              type: DEPENDENT
              key: 'zookeeper.max_latency[{#TYPE},{#CLIENT}]'
              value_type: FLOAT
              units: ms
              description: 'The maximum amount of time it takes for the server to respond to a client request.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.max_latency
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: requests
                - tag: type
                  value: '{#TYPE}'
            - uuid: 6a245634ec9b4aa0b2df8360b42ac8aa
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Latency, min'
              type: DEPENDENT
              key: 'zookeeper.min_latency[{#TYPE},{#CLIENT}]'
              value_type: FLOAT
              units: ms
              description: 'The minimum amount of time it takes for the server to respond to a client request.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.min_latency
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: requests
                - tag: type
                  value: '{#TYPE}'
            - uuid: 89805694583b453e99f833e850b5c5dc
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Outstanding requests'
              type: DEPENDENT
              key: 'zookeeper.outstanding_requests[{#TYPE},{#CLIENT}]'
              description: 'The number of queued requests when the server is under load and is receiving more sustained requests than it can process.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.outstanding_requests
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: requests
                - tag: type
                  value: '{#TYPE}'
            - uuid: e68a429aa986477e894b2a4437b6ec4a
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Packets received per sec'
              type: DEPENDENT
              key: 'zookeeper.packets_received[{#TYPE},{#CLIENT}]'
              value_type: FLOAT
              description: 'The number of packets received.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.packets_received
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: network
                - tag: type
                  value: '{#TYPE}'
            - uuid: c748207b3f3e4a7ca6bb8ff3ecc8959b
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Packets sent per sec'
              type: DEPENDENT
              key: 'zookeeper.packets_sent[{#TYPE},{#CLIENT}]'
              value_type: FLOAT
              description: 'The number of packets sent.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.packets_sent
                - type: CHANGE_PER_SECOND
              master_item:
                key: 'zookeeper.client_info[{#TYPE},{#CLIENT}]'
              tags:
                - tag: client
                  value: '{#CLIENT}'
                - tag: component
                  value: clients
                - tag: component
                  value: network
                - tag: type
                  value: '{#TYPE}'
          graph_prototypes:
            - uuid: 9ea4e5af47124317ba7f4502af97bc9c
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Latency'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Zookeeper by HTTP'
                    key: 'zookeeper.max_latency[{#TYPE},{#CLIENT}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Zookeeper by HTTP'
                    key: 'zookeeper.min_latency[{#TYPE},{#CLIENT}]'
                - sortorder: '2'
                  drawtype: BOLD_LINE
                  color: 00611C
                  item:
                    host: 'Zookeeper by HTTP'
                    key: 'zookeeper.avg_latency[{#TYPE},{#CLIENT}]'
            - uuid: b41e4ca001fe4a6789b1b4490861bd26
              name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Packets'
              graph_items:
                - color: 199C0D
                  item:
                    host: 'Zookeeper by HTTP'
                    key: 'zookeeper.packets_sent[{#TYPE},{#CLIENT}]'
                - sortorder: '1'
                  color: F63100
                  item:
                    host: 'Zookeeper by HTTP'
                    key: 'zookeeper.packets_received[{#TYPE},{#CLIENT}]'
          url: '{$ZOOKEEPER.SCHEME}://{$ZOOKEEPER.HOST}:{$ZOOKEEPER.PORT}/{$ZOOKEEPER.COMMAND_URL}/connections'
          preprocessing:
            - type: JAVASCRIPT
              parameters:
                - |
                  var source = JSON.parse(value),
                  	data = [];
                  
                  source.connections.forEach(function(v){
                  	data.push({
                  		"{#ADDRESS}": v.remote_socket_address,
                  		"{#CLIENT}": v.remote_socket_address.split(':')[0],
                  		"{#TYPE}": "connections"})
                  });
                  
                  source.secure_connections.forEach(function(v){
                  data.push({
                  	"{#ADDRESS}": v.remote_socket_address,
                  	"{#CLIENT}":v.remote_socket_address.split(':')[0],
                  	"{#TYPE}": "secure_connections"})
                  });
                  
                  return JSON.stringify(data);
        - uuid: 70e9fabfdfe446edae67a340f648612f
          name: 'Leader metrics discovery'
          type: DEPENDENT
          key: zookeeper.metrics.leader
          description: 'Additional metrics for leader node'
          item_prototypes:
            - uuid: 3a9b38e228a0438eae354cfc885b81ab
              name: 'Learners{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.learners[{#SINGLETON}]'
              description: 'Number of learners.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.learners
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: cluster
            - uuid: c6ae1476b69f43108f843508a02343a7
              name: 'Pending syncs{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.pending_syncs[{#SINGLETON}]'
              description: 'Number of pending syncs to carry out to ZooKeeper ensemble followers.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.pending_syncs
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: operations
              trigger_prototypes:
                - uuid: 004e26cca4934d1992b3c894f36b5643
                  expression: 'min(/Zookeeper by HTTP/zookeeper.pending_syncs[{#SINGLETON}],5m)>{$ZOOKEEPER.PENDING_SYNCS.MAX.WARN}'
                  name: 'Too many pending syncs'
                  event_name: 'Too many pending syncs (over {$ZOOKEEPER.PENDING_SYNCS.MAX.WARN}% for 5 min)'
                  priority: AVERAGE
                  manual_close: 'YES'
                  tags:
                    - tag: scope
                      value: performance
            - uuid: d5297a5598e94ef5acb1f6affdf51eee
              name: 'Quorum size{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.quorum_size[{#SINGLETON}]'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.quorum_size
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: cluster
            - uuid: 406d13a8d38a47498e939a118ec0329a
              name: 'Synced followers{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.synced_followers[{#SINGLETON}]'
              description: 'Number of synced followers reported when a node server_state is leader.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.synced_followers
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: cluster
            - uuid: 71c9de2ed85d4a5fb2306b24b9ca67d3
              name: 'Synced non-voting follower{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.synced_non_voting_followers[{#SINGLETON}]'
              description: 'Number of synced voting followers reported when a node server_state is leader.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.synced_non_voting_followers
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: cluster
            - uuid: 299da1a6343b47a4a25efe2d8581965e
              name: 'Synced observers{#SINGLETON}'
              type: DEPENDENT
              key: 'zookeeper.synced_observers[{#SINGLETON}]'
              description: 'Number of synced observers.'
              preprocessing:
                - type: JSONPATH
                  parameters:
                    - $.synced_observers
              master_item:
                key: zookeeper.get_metrics
              tags:
                - tag: component
                  value: cluster
          trigger_prototypes:
            - uuid: 4b0df830eef84e78a04a6980b627b8d0
              expression: 'last(/Zookeeper by HTTP/zookeeper.synced_followers[{#SINGLETON}]) < last(/Zookeeper by HTTP/zookeeper.quorum_size[{#SINGLETON}])-1'
              name: 'Too few active followers'
              priority: AVERAGE
              description: '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.'
              tags:
                - tag: scope
                  value: availability
          master_item:
            key: zookeeper.get_metrics
          preprocessing:
            - type: JSONPATH
              parameters:
                - $.server_state
            - type: JAVASCRIPT
              parameters:
                - 'return JSON.stringify(value == ''leader'' ? [{''{#SINGLETON}'': ''''}] : []);'
      tags:
        - tag: class
          value: application
        - tag: target
          value: zookeeper
      macros:
        - macro: '{$ZOOKEEPER.COMMAND_URL}'
          value: commands
          description: 'The URL for listing and issuing commands relative to the root URL (admin.commandURL).'
        - macro: '{$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}'
          value: '85'
          description: 'Maximum percentage of file descriptors usage alert threshold (for trigger expression).'
        - macro: '{$ZOOKEEPER.HOST}'
          value: '<SET ZOOKEEPER HOST>'
          description: 'The hostname or IP address of the Apache Zookeeper host.'
        - macro: '{$ZOOKEEPER.OUTSTANDING_REQ.MAX.WARN}'
          value: '10'
          description: 'Maximum number of outstanding requests (for trigger expression).'
        - macro: '{$ZOOKEEPER.PENDING_SYNCS.MAX.WARN}'
          value: '10'
          description: 'Maximum number of pending syncs from the followers (for trigger expression).'
        - macro: '{$ZOOKEEPER.PORT}'
          value: '8080'
          description: 'The port the embedded Jetty server listens on (admin.serverPort).'
        - macro: '{$ZOOKEEPER.SCHEME}'
          value: http
          description: 'Request scheme which may be http or https'
      dashboards:
        - uuid: 3c684a537ed74a0884ae663b97b23a9c
          name: 'Zookeeper: Overview'
          pages:
            - name: Main
              widgets:
                - type: item
                  name: Mode
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        key: zookeeper.server_state
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: graph
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper: Nodes'
                    - type: STRING
                      name: reference
                      value: AAAAA
                - type: graph
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper: Latency'
                    - type: STRING
                      name: reference
                      value: AAAAC
                - type: item
                  name: Uptime
                  x: '12'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        key: zookeeper.uptime
                    - type: INTEGER
                      name: show.0
                      value: '4'
                    - type: INTEGER
                      name: show.1
                      value: '2'
                - type: item
                  name: Version
                  x: '24'
                  width: '12'
                  fields:
                    - type: ITEM
                      name: itemid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        key: zookeeper.version
                    - type: INTEGER
                      name: show.0
                      value: '2'
                - type: graph
                  x: '36'
                  'y': '2'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper: Packets'
                    - type: STRING
                      name: reference
                      value: AAAAB
                - type: graph
                  x: '36'
                  'y': '7'
                  width: '36'
                  height: '5'
                  fields:
                    - type: GRAPH
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper: File descriptors usage'
                    - type: STRING
                      name: reference
                      value: AAAAD
            - name: Clients
              widgets:
                - type: graphprototype
                  width: '36'
                  height: '15'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Latency'
                    - type: STRING
                      name: reference
                      value: AAAAE
                    - type: INTEGER
                      name: rows
                      value: '3'
                - type: graphprototype
                  x: '36'
                  width: '36'
                  height: '15'
                  fields:
                    - type: INTEGER
                      name: columns
                      value: '1'
                    - type: GRAPH_PROTOTYPE
                      name: graphid.0
                      value:
                        host: 'Zookeeper by HTTP'
                        name: 'Zookeeper client {#TYPE} [{#CLIENT}]: Packets'
                    - type: STRING
                      name: reference
                      value: AAAAF
                    - type: INTEGER
                      name: rows
                      value: '3'
  triggers:
    - uuid: 53a97045bfd8473899849e429e3e7017
      expression: '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}'
      name: 'Too many file descriptors used'
      event_name: 'Too many file descriptors used (over {$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}% for 5 min)'
      priority: WARNING
      description: 'Number of file descriptors used more than {$ZOOKEEPER.FILE_DESCRIPTORS.MAX.WARN}% of the available number of file descriptors.'
      tags:
        - tag: scope
          value: capacity
  graphs:
    - uuid: 0553c91abfac4f8fb452b6b367055261
      name: 'Zookeeper: File descriptors usage'
      graph_items:
        - color: 199C0D
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.max_file_descriptor_count
        - sortorder: '1'
          color: F63100
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.open_file_descriptor_count
    - uuid: e4a53bcc70fa4688832dce28ca5f9c4a
      name: 'Zookeeper: Latency'
      graph_items:
        - color: 199C0D
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.max_latency
        - sortorder: '1'
          color: F63100
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.min_latency
        - sortorder: '2'
          drawtype: BOLD_LINE
          color: 00611C
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.avg_latency
    - uuid: 34d7f20585404aabac415c832c09a7ed
      name: 'Zookeeper: Nodes'
      graph_items:
        - color: 199C0D
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.znode_count
        - sortorder: '1'
          color: F63100
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.ephemerals_count
    - uuid: 8724517184844ee79c47f36b895cd564
      name: 'Zookeeper: Packets'
      graph_items:
        - color: 199C0D
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.packets_sent
        - sortorder: '1'
          color: F63100
          item:
            host: 'Zookeeper by HTTP'
            key: zookeeper.packets_received.rate
