ping

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: 11 Imported by: 0

README

ping

ping 监控插件,探测远端目标地址能否 ping 通,如果机器没有禁 ping,这就是一个很好用的探测机器存活的手段

Configuration

要探测的机器配置到 targets 中,targets 是个数组,可以配置多个,当然也可以拆成多个 [[instances]] 配置段,比如:

[[instances]]
targets = [ "10.4.5.6" ]
labels = { region="cloud", product="n9e" }

[[instances]]
targets = [ "10.4.5.7" ]
labels = { region="cloud", product="zbx" }

上例中是 ping 两个地址,为了信息更丰富,附加了 region 和 product 标签

File Limit

systemctl edit categraf

Increase the number of open files:

[Service]
LimitNOFILE=8192

Restart Categraf:

systemctl restart categraf
Linux Permissions

On most systems, ping requires CAP_NET_RAW capabilities or for Categraf to be run as root.

With systemd:

systemctl edit categraf
[Service]
CapabilityBoundingSet=CAP_NET_RAW
AmbientCapabilities=CAP_NET_RAW
systemctl restart categraf

Without systemd:

setcap cap_net_raw=eip /usr/bin/categraf

Reference man 7 capabilities for more information about setting capabilities.

Other OS Permissions

When using method = "native", you will need permissions similar to the executable ping program for your OS.

监控大盘和告警规则

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

新增PING大盘2.0

dashboard-2.0.png

大盘地址 dashboard-2.0.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

	Targets      []string `toml:"targets"`
	Count        int      `toml:"count"`         // ping -c <COUNT>
	PingInterval float64  `toml:"ping_interval"` // ping -i <INTERVAL>
	Timeout      float64  `toml:"timeout"`       // ping -W <TIMEOUT>
	Interface    string   `toml:"interface"`     // ping -I/-S <INTERFACE/SRC_ADDR>
	IPv6         bool     `toml:"ipv6"`          // Whether to resolve addresses using ipv6 or not.
	Size         *int     `toml:"size"`          // Packet size
	Conc         int      `toml:"concurrency"`   // max concurrency coroutine
	// contains filtered or unexported fields
}

func (*Instance) Gather

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

func (*Instance) Init

func (ins *Instance) Init() error

type Ping

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

func (*Ping) Clone

func (p *Ping) Clone() inputs.Input

func (*Ping) GetInstances

func (p *Ping) GetInstances() []inputs.Instance

func (*Ping) Name

func (p *Ping) Name() string

Jump to

Keyboard shortcuts

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