]> arthur.barton.de Git - netdata.git/commitdiff
updated fping plugin
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 31 Oct 2016 22:03:25 +0000 (00:03 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Mon, 31 Oct 2016 22:03:25 +0000 (00:03 +0200)
conf.d/fping.conf
plugins.d/fping.plugin

index 3bf804777fe0dbfb5dd2d0f7247bc5d9696092e7..071fffcc5a4c7fa957052b8bb805311dcd1af993 100644 (file)
@@ -1,32 +1,48 @@
-# This plugin requires a special version of fping.
+# no need for shebang - this file is sourced from fping.plugin
+
+# fping.plugin requires a special version of fping.
 # Get it from https://github.com/ktsaou/fping
 # and build it, like this:
-#
-# cd /usr/src
-# git clone https://github.com/ktsaou/fping.git fping-netdata.git
-# cd fping-netdata.git
-# ./autogen.sh
-# ./configure --prefix=/usr/local
-# make
-# cp src/fping /usr/local/bin/
-# chown root:root /usr/local/bin/fping
-# chmod 4755 /usr/local/bin/fping
-#
+
+cat >/dev/null <<EOF
+cd /usr/src && \
+git clone https://github.com/ktsaou/fping.git fping-netdata.git && \
+cd fping-netdata.git && \
+./autogen.sh && \
+./configure --prefix=/usr/local && \
+make && \
+cp src/fping /usr/local/bin/ && \
+chown root:root /usr/local/bin/fping && \
+chmod 4755 /usr/local/bin/fping && \
+echo "DONE"
+EOF
+
 # -----------------------------------------------------------------------------
 # configuration options
-# can be overwritten at /etc/netdata/fping.conf
 
-# the fping binary to use
-# we need one that can output netdata friendly info
-fping="$(which fping || command -v fping)"
+# The update frequency of the chart - the default is inherited from netdata
+
+#update_every=2
+
+# The fping binary to use. We need one that can output netdata friendly info
+# (supporting: -N). If you have multiple versions, put here the full filename
+# of the right one
+
+#fping="/usr/local/bin/fping"
 
 # a space separated list of hosts to fping
-# it is best to put hostnames here
+# we suggest to put names here and the IPs of these names in /etc/hosts
+
 hosts=""
 
-# the time in milliseconds (1 sec = 1000 ms)
-# to ping the hosts - by default 2 pings per iteration
-ping_every="$((update_every * 1000 / 2))"
+# The time in milliseconds (1 sec = 1000 ms) to ping the hosts
+# by default 5 pings per host per iteration
+
+ping_every="$((update_every * 1000 / 5))"
+
+# other fping options
+# -R   = send packets with random data
+# -i 1 = send one packet every 1 ms (i.e how fast to switch hosts)
+# -r 0 = never retry packets
 
-# how many retries to make if a host does not respond
-retries=1
+other_opts="-R -i 1 -r 0"
index 784bf2993e05ebad60b2b96d4860e67f1142f2a5..5c70ba3419ae131b9d4ffee58772dd6cbd2858fc 100755 (executable)
@@ -79,18 +79,20 @@ NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
 # can be overwritten at /etc/netdata/fping.conf
 
 # the fping binary to use
-# we need one that can output netdata friendly info
-fping="$(which fping 2>/dev/null || command -v fping 2>/dev/null )"
+# we need one that can output netdata friendly info (supporting: -N)
+# if you have multiple versions, put here the full filename of the right one
+fping="$( which fping 2>/dev/null || command -v fping 2>/dev/null )"
 
 # a space separated list of hosts to fping
+# we suggest to put names here and the IPs of these names in /etc/hosts
 hosts=""
 
 # the time in milliseconds (1 sec = 1000 ms)
-# to ping the hosts - by default 2 pings per iteration
-ping_every="$((update_every * 1000 / 2))"
+# to ping the hosts - by default 5 pings per host per iteration
+ping_every="$((update_every * 1000 / 5))"
 
-# how many retries to make if a host does not respond
-retries=1
+# other fping options
+other_opts="-R -i 1 -r 0"
 
 # -----------------------------------------------------------------------------
 # load the configuration file
@@ -113,7 +115,7 @@ then
 fi
 
 # the fping options we will use
-options=( -N -l -R -Q ${update_every} -p ${ping_every} -r ${retries} ${hosts} )
+options=( -N -l -Q ${update_every} -p ${ping_every} ${other_opts} ${hosts} )
 
 # execute fping
 exec "${fping}" "${options[@]}"