Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
Zookeper module (#255)
Browse files Browse the repository at this point in the history
* add zookeeper module
  • Loading branch information
ilyam8 authored Aug 24, 2019
1 parent e2059a1 commit 02b5f76
Show file tree
Hide file tree
Showing 11 changed files with 857 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/godplugin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
_ "github.com/netdata/go.d.plugin/modules/weblog"
_ "github.com/netdata/go.d.plugin/modules/wmi"
_ "github.com/netdata/go.d.plugin/modules/x509check"
_ "github.com/netdata/go.d.plugin/modules/zookeeper"
)

var (
Expand Down
119 changes: 119 additions & 0 deletions config/go.d/zookeeper.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# netdata go.d.plugin configuration for zookeeper
#
# This file is in YaML format. Generally the format is:
#
# name: value
#
# There are 2 sections:
# - GLOBAL
# - JOBS
#
#
# [ GLOBAL ]
# These variables set the defaults for all JOBs, however each JOB may define its own, overriding the defaults.
#
# The GLOBAL section format:
# param1: value1
# param2: value2
#
# Currently supported global parameters:
# - update_every
# Data collection frequency in seconds. Default: 1.
#
# - autodetection_retry
# Re-check interval in seconds. Attempts to start the job are made once every interval.
# Zero means not to schedule re-check. Default: 0.
#
# - priority
# Priority is the relative priority of the charts as rendered on the web page,
# lower numbers make the charts appear before the ones with higher numbers. Default: 70000.
#
#
# [ JOBS ]
# JOBS allow you to collect values from multiple sources.
# Each source will have its own set of charts.
#
# IMPORTANT:
# - Parameter 'name' is mandatory.
# - Jobs with the same name are mutually exclusive. Only one of them will be allowed running at any time.
#
# This allows autodetection to try several alternatives and pick the one that works.
# Any number of jobs is supported.
#
# The JOBS section format:
#
# jobs:
# - name: job1
# param1: value1
# param2: value2
#
# - name: job2
# param1: value1
# param2: value2
#
# - name: job2
# param1: value1
#
#
# [ List of JOB specific parameters ]:
# - address
# Server address.
# Syntax:
# address: 127.0.0.1:2181
#
# - timeout
# Connection/read/write/ssl handshake timeout.
# Syntax:
# timeout: 1
#
# - use_tls
# Whether to use or not TLS.
# Syntax:
# use_tls: true
#
# - tls_skip_verify
# Whether to skip verifying server's certificate chain and hostname.
# Syntax:
# tls_skip_verify: yes/no
#
# - tls_ca
# Certificate authority that client use when verifying server certificates.
# Syntax:
# tls_ca: path/to/ca.pem
#
# - tls_cert
# Client tls certificate.
# Syntax:
# tls_cert: path/to/cert.pem
#
# - tls_key
# Client tls key.
# Syntax:
# tls_key: path/to/key.pem
#
#
# [ JOB defaults ]:
# address: 127.0.0.1:2181
# timeout: 1
# use_tls: false
# tls_skip_verify: no
#
#
# [ JOB mandatory parameters ]:
# - name
# - address
#
# ------------------------------------------------MODULE-CONFIGURATION--------------------------------------------------
# [ GLOBAL ]
# update_every: 1
# autodetection_retry: 0
# priority: 70000
#
#
# [ JOBS ]
jobs:
- name: local
address: 127.0.0.1:2181

- name: local
address: 127.0.0.1:2182
38 changes: 38 additions & 0 deletions modules/zookeeper/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# zookeeper

This module will monitor one or more [`Zookeeper`](https://zookeeper.apache.org/) servers depending on configuration.

**Requirements:**
* `Zookeeper` with accessible client port
* whitelisted `mntr` command

It produces the following charts:
- Outstanding Requests in `requests`
- Requests Latency in `ms`
- Alive Connections in `connections`
- Packets in `pps`
- Open File Descriptors in `file descriptors`
- Number of Nodes in `nodes`
- Number of Watches in `watches`
- Approximate Data Tree Size in `KiB`
- Server State in `state`


### configuration

Needs only `address` to server's client port.

Here is an example for 2 servers:

```yaml
jobs:
- name : local
address : 127.0.0.1:2181

- name : remote
address : 203.0.113.10:2182
```
For all available options please see module [configuration file](https://github.com/netdata/go.d.plugin/blob/master/config/go.d/zookeeper.conf).
---
109 changes: 109 additions & 0 deletions modules/zookeeper/charts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
package zookeeper

import "github.com/netdata/go-orchestrator/module"

type (
Charts = module.Charts
Dims = module.Dims
Vars = module.Vars
)

var charts = Charts{
{
ID: "requests",
Title: "Outstanding Requests",
Units: "requests",
Fam: "requests",
Ctx: "zookeeper.requests",
Dims: Dims{
{ID: "outstanding_requests", Name: "outstanding"},
},
},
{
ID: "requests_latency",
Title: "Requests Latency",
Units: "ms",
Fam: "requests",
Ctx: "zookeeper.requests_latency",
Dims: Dims{
{ID: "min_latency", Name: "min"},
{ID: "avg_latency", Name: "avg"},
{ID: "max_latency", Name: "max"},
},
},
{
ID: "connections",
Title: "Alive Connections",
Units: "connections",
Fam: "connections",
Ctx: "zookeeper.connections",
Dims: Dims{
{ID: "num_alive_connections", Name: "alive"},
},
},
{
ID: "packets",
Title: "Packets",
Units: "pps",
Fam: "net",
Ctx: "zookeeper.packets",
Dims: Dims{
{ID: "packets_received", Name: "received", Algo: module.Incremental},
{ID: "packets_sent", Name: "sent", Algo: module.Incremental, Mul: -1},
},
},
{
ID: "file_descriptor",
Title: "Open File Descriptors",
Units: "file descriptors",
Fam: "file descriptors",
Ctx: "zookeeper.file_descriptor",
Dims: Dims{
{ID: "open_file_descriptor_count", Name: "open"},
},
Vars: Vars{
{ID: "max_file_descriptor_count"},
},
},
{
ID: "nodes",
Title: "Number of Nodes",
Units: "nodes",
Fam: "data tree",
Ctx: "zookeeper.nodes",
Dims: Dims{
{ID: "znode_count", Name: "znode"},
{ID: "ephemerals_count", Name: "ephemerals"},
},
},
{
ID: "watches",
Title: "Number of Watches",
Units: "watches",
Fam: "data tree",
Ctx: "zookeeper.watches",
Dims: Dims{
{ID: "watch_count", Name: "watches"},
},
},
{
ID: "approximate_data_size",
Title: "Approximate Data Tree Size",
Units: "KiB",
Fam: "data tree",
Ctx: "zookeeper.approximate_data_size",
Dims: Dims{
{ID: "approximate_data_size", Name: "size", Div: 1024},
},
},
{
ID: "server_state",
Title: "Server State",
Units: "state",
Fam: "server state",
Ctx: "zookeeper.server_state",
Dims: Dims{
{ID: "server_state", Name: "state"},
},
},
}
Loading

0 comments on commit 02b5f76

Please sign in to comment.