charts.d can be added multiple times
Costa Tsaousis (ktsaou) committed
Nov 18, 2015 at 10:44 UTC
070bc5b094673943de88d10920f8d3e6be29f706
2 files changed
+17
-4
charts.d/squid.chart.sh
+4
@@ -16,6 +16,10 @@ EOF
16
}
17
18
squid_check() {
19
+ require_cmd nc || return 1
20
+ require_cmd sed || return 1
21
+ require_cmd egrep || return 1
22
+
23
squid_url="cache_object://$squid_host:$squid_port/counters"
24
25
# check once if the url works
plugins.d/charts.d.plugin
+13
-4
@@ -1,7 +1,15 @@
1
#!/bin/bash
2
3
PROGRAM_FILE="$0"
4
-PROGRAM_NAME="charts.d"
4
+PROGRAM_NAME="$(basename $0)"
5
+PROGRAM_NAME="${PROGRAM_NAME/.plugin}"
6
+
7
+# if you need to run parallel charts.d processes
8
+# just link this files with a different name
9
+# in the same directory, with a .plugin suffix
10
+# netdata will start multiple of them
11
+# each will have a different config file
12
+
13
echo >&2 "$PROGRAM_NAME: started from '$PROGRAM_FILE' with options: $*"
14
15
if [ $(( ${BASH_VERSINFO[0]} )) -lt 4 ]
@@ -47,7 +55,8 @@ pluginsd="${NETDATA_PLUGINS_DIR}"
55
56
confd="${NETDATA_CONFIG_DIR-/etc/netdata}"
57
chartsd="$pluginsd/../charts.d"
50
-myconfig="$confd/charts.d.conf"
58
+
59
+myconfig="$confd/$PROGRAM_NAME.conf"
60
61
minimum_update_frequency="${NETDATA_UPDATE_EVERY-1}"
62
update_every=${minimum_update_frequency} # this will be overwritten by the command line
@@ -331,9 +340,9 @@ trap chartsd_cleanup INT
340
341
if [ $UID = "0" ]
342
then
334
- TMP_DIR="$( mktemp -d /var/run/netdata-charts.d-XXXXXXXXXX )"
343
+ TMP_DIR="$( mktemp -d /var/run/netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
344
else
336
- TMP_DIR="$( mktemp -d /tmp/.netdata-charts.d-XXXXXXXXXX )"
345
+ TMP_DIR="$( mktemp -d /tmp/.netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
346
fi
347
348
cd "$TMP_DIR" || exit 1