5 # the frequency to send info to netdata
6 # passed by netdata as the first parameter
9 # the netdata configuration directory
10 # passed by netdata as an environment variable
11 NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
13 # -----------------------------------------------------------------------------
15 # This plugin requires a special version of fping.
16 # Get it from https://github.com/ktsaou/fping
17 # and build it, like this:
20 # git clone https://github.com/ktsaou/fping.git fping-netdata.git
21 # cd fping-netdata.git
23 # ./configure --prefix=/usr/local
25 # cp src/fping /usr/local/bin/
26 # chown root:root /usr/local/bin/fping
27 # chmod 4755 /usr/local/bin/fping
29 # Then, create /etc/netdata/fping.conf
30 # and set the configuration options given below
32 # -----------------------------------------------------------------------------
33 # configuration options
34 # can be overwritten at /etc/netdata/fping.conf
36 # the fping binary to use
37 # we need one that can output netdata friendly info
38 fping="$(which fping || command -v fping)"
40 # a space separated list of hosts to fping
43 # the time in milliseconds (1 sec = 1000 ms)
44 # to ping the hosts - by default 2 pings per iteration
45 ping_every="$((update_every * 1000 / 2))"
47 # how many retries to make if a host does not respond
50 # -----------------------------------------------------------------------------
52 # load the configuration file
53 if [ ! -f "${NETDATA_CONFIG_DIR}/fping.conf" ]
55 echo >&2 "${me}: configuration file '${NETDATA_CONFIG_DIR}/fping.conf' not found - nothing to do."
60 source "${NETDATA_CONFIG_DIR}/fping.conf"
64 echo >&2 "${me}: no hosts configued in '${NETDATA_CONFIG_DIR}/fping.conf' - nothing to do."
69 if [ -z "${fping}" -o ! -x "${fping}" ]
71 echo >&2 "${me}: command '${fping}' is not executable - cannot proceed."
76 # the fping options we will use
77 options=( -N -l -R -Q ${update_every} -p ${ping_every} -r ${retries} ${hosts} )
80 exec "${fping}" "${options[@]}"
82 # if we cannot execute fping, stop
83 echo >&2 "${me}: command '${fping} ${options[@]}' failed to be executed."