From 95b33f4bad4613db92210e6f9d3a5fcd1717122c Mon Sep 17 00:00:00 2001 From: "Costa Tsaousis (ktsaou)" Date: Fri, 30 Dec 2016 01:57:08 +0200 Subject: [PATCH 1/1] allow multiple fping plugins to be running with different settings each --- plugins.d/fping.plugin | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins.d/fping.plugin b/plugins.d/fping.plugin index 3a61ab33..d523f447 100755 --- a/plugins.d/fping.plugin +++ b/plugins.d/fping.plugin @@ -104,6 +104,14 @@ debug() { [ $debug -eq 1 ] && log DEBUG "${@}" } +# ----------------------------------------------------------------------------- + +# store in ${plugin} the name we run under +# this allows us to copy/link fping.plugin under a different name +# to have multiple fping plugins running with different settings +plugin="${PROGRAM_NAME/.plugin/}" + + # ----------------------------------------------------------------------------- # the frequency to send info to netdata @@ -137,21 +145,21 @@ fping_opts="-R -b 56 -i 1 -r 0 -t 5000" # ----------------------------------------------------------------------------- # load the configuration file -if [ ! -f "${NETDATA_CONFIG_DIR}/fping.conf" ] +if [ ! -f "${NETDATA_CONFIG_DIR}/${plugin}.conf" ] then - fatal "configuration file '${NETDATA_CONFIG_DIR}/fping.conf' not found - nothing to do." + fatal "configuration file '${NETDATA_CONFIG_DIR}/${plugin}.conf' not found - nothing to do." fi -source "${NETDATA_CONFIG_DIR}/fping.conf" +source "${NETDATA_CONFIG_DIR}/${plugin}.conf" if [ -z "${hosts}" ] then - fatal "no hosts configued in '${NETDATA_CONFIG_DIR}/fping.conf' - nothing to do." + fatal "no hosts configued in '${NETDATA_CONFIG_DIR}/${plugin}.conf' - nothing to do." fi if [ -z "${fping}" -o ! -x "${fping}" ] then - fatal "command '${fping}' is not executable - cannot proceed." + fatal "command '${fping}' is not found or is not executable - cannot proceed." fi if [ ${ping_every} -lt 20 ] -- 2.39.2