zookeeper

package
v0.0.0-...-5655933 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 14 Imported by: 0

README

zookeeper

注意: >=3.6.0 zookeeper 版本内置 prometheus 的支持,即,如果 zookeeper 启用了 prometheus,Categraf 可使用 prometheus 插件从这个 metrics 接口拉取数据即可;

移植于 dabealu/zookeeper-exporter,适用于 <3.6.0 版本的 zookeeper, 原理就是利用 Zookeper 提供的四字命令(The Four Letter Words)获取监控信息;

需要注意的是,在 zookeeper v3.4.10 以后添加了四字命令白名单,需要在 zookeeper 的配置文件 zoo.cfg 中新增白名单配置:

4lw.commands.whitelist=mntr,ruok

Configuration

zookeeper 插件的配置在 conf/input.zookeeper/zookeeper.toml 集群中的多个实例地址请用空格分隔:

[[instances]]
cluster_name = "dev-zk-cluster"
addresses = "127.0.0.1:2181"
timeout = 10

如果要监控多个 zookeeper 集群,就增加 instances 即可:

[[instances]]
cluster_name = "dev-zk-cluster"
addresses = "127.0.0.1:2181"
timeout = 10

[[instances]]
cluster_name = "test-zk-cluster"
addresses = "127.0.0.1:2181 127.0.0.1:2182 127.0.0.1:2183"
timeout = 10

监控大盘和告警规则

该 README 的同级目录下,提供了 dashboard.json 就是监控大盘的配置,alerts.json 是告警规则,可以导入夜莺使用。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	config.InstanceConfig

	Addresses   string `toml:"addresses"`
	Timeout     int    `toml:"timeout"`
	ClusterName string `toml:"cluster_name"`
	tls.ClientConfig
}

func (*Instance) Gather

func (ins *Instance) Gather(slist *types.SampleList)

func (*Instance) Init

func (ins *Instance) Init() error

func (*Instance) ZkConnect

func (ins *Instance) ZkConnect(host string) (net.Conn, error)

func (*Instance) ZkHosts

func (ins *Instance) ZkHosts() []string

type Zookeeper

type Zookeeper struct {
	config.PluginConfig
	Instances []*Instance `toml:"instances"`
}

func (*Zookeeper) Clone

func (z *Zookeeper) Clone() inputs.Input

func (*Zookeeper) GetInstances

func (z *Zookeeper) GetInstances() []inputs.Instance

func (*Zookeeper) Name

func (z *Zookeeper) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL