categraf/inputs/ping
Ulric Qin e9d7d50f2b modify default settings 2022-07-11 12:30:49 +08:00
..
README.md add some README doc 2022-06-13 16:45:15 +08:00
alerts.json code refactor 2022-05-02 00:02:15 +08:00
dashboard.json fix: ping dashboard metric error fix 2022-06-25 11:11:37 +08:00
ping.go modify default settings 2022-07-11 12:30:49 +08:00

README.md

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 是告警规则,可以导入夜莺使用。