remove static references to /etc/netdata from plugins and use /../../../../etc/netdata relative to plugin file; fixes #2264
Costa Tsaousis (ktsaou) committed
Jun 15, 2017 at 02:35 UTC
30a4d477a9eea6d4b9d3d996fda74b94b0b0b3dc
8 files changed
+24
-19
plugins.d/alarm-notify.sh
+2
-2
@@ -122,8 +122,8 @@ custom_sender() {
122
# -----------------------------------------------------------------------------
123
# defaults to allow running this script by hand
124
125
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
126
-NETDATA_CACHE_DIR="${NETDATA_CACHE_DIR-/var/cache/netdata}"
125
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
126
+[ -z "${NETDATA_CACHE_DIR}" ] && NETDATA_CACHE_DIR="$(dirname "${0}")/../../../../var/cache/netdata"
127
[ -z "${NETDATA_REGISTRY_URL}" ] && NETDATA_REGISTRY_URL="https://registry.my-netdata.io"
128
129
# -----------------------------------------------------------------------------
plugins.d/alarm-test.sh
+1
-1
@@ -2,7 +2,7 @@
2
3
# netdata
4
# real-time performance and health monitoring, done right!
5
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
5
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
6
# GPL v3+
7
#
8
# Script to test alarm notifications for netdata
plugins.d/cgroup-name.sh
+1
-1
@@ -51,7 +51,7 @@ debug() {
51
52
# -----------------------------------------------------------------------------
53
54
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
54
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
55
CONFIG="${NETDATA_CONFIG_DIR}/cgroups-names.conf"
56
CGROUP="${1}"
57
NAME=
plugins.d/charts.d.plugin
+5
-4
@@ -2,7 +2,7 @@
2
3
# netdata
4
# real-time performance and health monitoring, done right!
5
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
5
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
6
# GPL v3+
7
#
8
# charts.d.plugin allows easy development of BASH plugins
@@ -115,10 +115,11 @@ info "started from '$PROGRAM_FILE' with options: $*"
115
# internal defaults
116
# netdata exposes a few environment variables for us
117
118
-pluginsd="${NETDATA_PLUGINS_DIR}"
119
-[ -z "$pluginsd" ] && pluginsd="$( dirname $PROGRAM_FILE )"
118
+[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
119
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
120
121
-confd="${NETDATA_CONFIG_DIR-/etc/netdata}"
121
+pluginsd="${NETDATA_PLUGINS_DIR}"
122
+confd="${NETDATA_CONFIG_DIR}"
123
chartsd="$pluginsd/../charts.d"
124
125
myconfig="$confd/$PROGRAM_NAME.conf"
plugins.d/fping.plugin
+2
-2
@@ -2,7 +2,7 @@
2
3
# netdata
4
# real-time performance and health monitoring, done right!
5
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
5
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
6
# GPL v3+
7
#
8
# This plugin requires a latest version of fping.
@@ -129,7 +129,7 @@ update_every="${1-1}"
129
130
# the netdata configuration directory
131
# passed by netdata as an environment variable
132
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
132
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
133
134
# -----------------------------------------------------------------------------
135
# configuration options
plugins.d/node.d.plugin
+3
-3
@@ -4,13 +4,13 @@
4
// shebang hack from:
5
// http://unix.stackexchange.com/questions/65235/universal-node-js-shebang
6
7
-// Initially this is run as a shell script (#!/bin/sh).
7
+// Initially this is run as a shell script.
8
// Then, the second line, finds nodejs or node or js in the system path
9
// and executes it with the shell parameters.
10
11
// netdata
12
// real-time performance and health monitoring, done right!
13
-// (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
13
+// (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
14
// GPL v3+
15
16
// --------------------------------------------------------------------------------------------------------------------
@@ -21,7 +21,7 @@
21
// get NETDATA environment variables
22
23
var NETDATA_PLUGINS_DIR = process.env.NETDATA_PLUGINS_DIR || __dirname;
24
-var NETDATA_CONFIG_DIR = process.env.NETDATA_CONFIG_DIR || '/etc/netdata';
24
+var NETDATA_CONFIG_DIR = process.env.NETDATA_CONFIG_DIR || __dirname + '/../../../../etc/netdata';
25
var NETDATA_UPDATE_EVERY = process.env.NETDATA_UPDATE_EVERY || 1;
26
var NODE_D_DIR = NETDATA_PLUGINS_DIR + '/../node.d';
27
plugins.d/python.d.plugin
+5
-2
@@ -20,8 +20,11 @@ BASE_CONFIG = {'update_every': os.getenv('NETDATA_UPDATE_EVERY', 1),
20
'retries': 10}
21
22
MODULES_DIR = os.path.abspath(os.getenv('NETDATA_PLUGINS_DIR',
23
- os.path.dirname(__file__)) + "/../python.d") + "/"
24
-CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/")
23
+ os.path.dirname(__file__)) + "/../python.d") + "/"
24
+
25
+CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR',
26
+ os.path.dirname(__file__)) + "/../../../../etc/netdata")
27
+
28
# directories should end with '/'
29
if CONFIG_DIR[-1] != "/":
30
CONFIG_DIR += "/"
plugins.d/tc-qos-helper.sh
+5
-4
@@ -2,7 +2,7 @@
2
3
# netdata
4
# real-time performance and health monitoring, done right!
5
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
5
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
6
# GPL v3+
7
#
8
# This script is a helper to allow netdata collect tc data.
@@ -101,10 +101,11 @@ debug() {
101
102
# -----------------------------------------------------------------------------
103
104
-plugins_dir="${NETDATA_PLUGINS_DIR}"
105
-[ -z "$plugins_dir" ] && plugins_dir="$( dirname $PROGRAM_FILE )"
104
+[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
105
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
106
107
-config_dir=${NETDATA_CONFIG_DIR-/etc/netdata}
107
+plugins_dir="${NETDATA_PLUGINS_DIR}"
108
+config_dir="${NETDATA_CONFIG_DIR}"
109
tc="$(which tc 2>/dev/null || command -v tc 2>/dev/null)"
110
111