@cryptotaxi247 / netdata-1 / commits / 95b33f4ba

allow multiple fping plugins to be running with different settings each

Costa Tsaousis (ktsaou) committed Dec 30, 2016 at 01:57 UTC 95b33f4bad4613db92210e6f9d3a5fcd1717122c
1 file changed +13 -5
plugins.d/fping.plugin
+13 -5
@@ -104,6 +104,14 @@ debug() {
104 [ $debug -eq 1 ] && log DEBUG "${@}"
105 }
106
107 +# -----------------------------------------------------------------------------
108 +
109 +# store in ${plugin} the name we run under
110 +# this allows us to copy/link fping.plugin under a different name
111 +# to have multiple fping plugins running with different settings
112 +plugin="${PROGRAM_NAME/.plugin/}"
113 +
114 +
115 # -----------------------------------------------------------------------------
116
117 # the frequency to send info to netdata
@@ -137,21 +145,21 @@ fping_opts="-R -b 56 -i 1 -r 0 -t 5000"
145 # -----------------------------------------------------------------------------
146 # load the configuration file
147
140 -if [ ! -f "${NETDATA_CONFIG_DIR}/fping.conf" ]
148 +if [ ! -f "${NETDATA_CONFIG_DIR}/${plugin}.conf" ]
149 then
142 - fatal "configuration file '${NETDATA_CONFIG_DIR}/fping.conf' not found - nothing to do."
150 + fatal "configuration file '${NETDATA_CONFIG_DIR}/${plugin}.conf' not found - nothing to do."
151 fi
152
145 -source "${NETDATA_CONFIG_DIR}/fping.conf"
153 +source "${NETDATA_CONFIG_DIR}/${plugin}.conf"
154
155 if [ -z "${hosts}" ]
156 then
149 - fatal "no hosts configued in '${NETDATA_CONFIG_DIR}/fping.conf' - nothing to do."
157 + fatal "no hosts configued in '${NETDATA_CONFIG_DIR}/${plugin}.conf' - nothing to do."
158 fi
159
160 if [ -z "${fping}" -o ! -x "${fping}" ]
161 then
154 - fatal "command '${fping}' is not executable - cannot proceed."
162 + fatal "command '${fping}' is not found or is not executable - cannot proceed."
163 fi
164
165 if [ ${ping_every} -lt 20 ]