updated fping plugin
Costa Tsaousis (ktsaou) committed
Nov 1, 2016 at 00:03 UTC
ed9c6ff828b3e778f3cc3fbcee613dd1c27f0dca
2 files changed
+47
-29
conf.d/fping.conf
+38
-22
@@ -1,32 +1,48 @@
1
-# This plugin requires a special version of fping.
1
+# no need for shebang - this file is sourced from fping.plugin
2
+
3
+# fping.plugin requires a special version of fping.
4
# Get it from https://github.com/ktsaou/fping
5
# and build it, like this:
4
-#
5
-# cd /usr/src
6
-# git clone https://github.com/ktsaou/fping.git fping-netdata.git
7
-# cd fping-netdata.git
8
-# ./autogen.sh
9
-# ./configure --prefix=/usr/local
10
-# make
11
-# cp src/fping /usr/local/bin/
12
-# chown root:root /usr/local/bin/fping
13
-# chmod 4755 /usr/local/bin/fping
14
-#
6
+
7
+cat >/dev/null <<EOF
8
+cd /usr/src && \
9
+git clone https://github.com/ktsaou/fping.git fping-netdata.git && \
10
+cd fping-netdata.git && \
11
+./autogen.sh && \
12
+./configure --prefix=/usr/local && \
13
+make && \
14
+cp src/fping /usr/local/bin/ && \
15
+chown root:root /usr/local/bin/fping && \
16
+chmod 4755 /usr/local/bin/fping && \
17
+echo "DONE"
18
+EOF
19
+
20
# -----------------------------------------------------------------------------
21
# configuration options
17
-# can be overwritten at /etc/netdata/fping.conf
22
19
-# the fping binary to use
20
-# we need one that can output netdata friendly info
21
-fping="$(which fping || command -v fping)"
23
+# The update frequency of the chart - the default is inherited from netdata
24
+
25
+#update_every=2
26
+
27
+# The fping binary to use. We need one that can output netdata friendly info
28
+# (supporting: -N). If you have multiple versions, put here the full filename
29
+# of the right one
30
+
31
+#fping="/usr/local/bin/fping"
32
33
# a space separated list of hosts to fping
24
-# it is best to put hostnames here
34
+# we suggest to put names here and the IPs of these names in /etc/hosts
35
+
36
hosts=""
37
27
-# the time in milliseconds (1 sec = 1000 ms)
28
-# to ping the hosts - by default 2 pings per iteration
29
-ping_every="$((update_every * 1000 / 2))"
38
+# The time in milliseconds (1 sec = 1000 ms) to ping the hosts
39
+# by default 5 pings per host per iteration
40
+
41
+ping_every="$((update_every * 1000 / 5))"
42
+
43
+# other fping options
44
+# -R = send packets with random data
45
+# -i 1 = send one packet every 1 ms (i.e how fast to switch hosts)
46
+# -r 0 = never retry packets
47
31
-# how many retries to make if a host does not respond
32
-retries=1
48
+other_opts="-R -i 1 -r 0"
plugins.d/fping.plugin
+9
-7
@@ -79,18 +79,20 @@ NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
79
# can be overwritten at /etc/netdata/fping.conf
80
81
# the fping binary to use
82
-# we need one that can output netdata friendly info
83
-fping="$(which fping 2>/dev/null || command -v fping 2>/dev/null )"
82
+# we need one that can output netdata friendly info (supporting: -N)
83
+# if you have multiple versions, put here the full filename of the right one
84
+fping="$( which fping 2>/dev/null || command -v fping 2>/dev/null )"
85
86
# a space separated list of hosts to fping
87
+# we suggest to put names here and the IPs of these names in /etc/hosts
88
hosts=""
89
90
# the time in milliseconds (1 sec = 1000 ms)
89
-# to ping the hosts - by default 2 pings per iteration
90
-ping_every="$((update_every * 1000 / 2))"
91
+# to ping the hosts - by default 5 pings per host per iteration
92
+ping_every="$((update_every * 1000 / 5))"
93
92
-# how many retries to make if a host does not respond
93
-retries=1
94
+# other fping options
95
+other_opts="-R -i 1 -r 0"
96
97
# -----------------------------------------------------------------------------
98
# load the configuration file
@@ -113,7 +115,7 @@ then
115
fi
116
117
# the fping options we will use
116
-options=( -N -l -R -Q ${update_every} -p ${ping_every} -r ${retries} ${hosts} )
118
+options=( -N -l -Q ${update_every} -p ${ping_every} ${other_opts} ${hosts} )
119
120
# execute fping
121
exec "${fping}" "${options[@]}"