summaryrefslogtreecommitdiffstats
path: root/plugins.d
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-06-15 02:35:49 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-06-15 02:35:49 +0300
commit30a4d477a9eea6d4b9d3d996fda74b94b0b0b3dc (patch)
tree9de923a3bb426b831a9d3b9fef87bab0fd7844e5 /plugins.d
parent73a7970a18f2b9d17b74f23f50646ed6776ad3e2 (diff)
remove static references to /etc/netdata from plugins and use /../../../../etc/netdata relative to plugin file; fixes #2264
Diffstat (limited to 'plugins.d')
-rwxr-xr-xplugins.d/alarm-notify.sh4
-rwxr-xr-xplugins.d/alarm-test.sh2
-rwxr-xr-xplugins.d/cgroup-name.sh2
-rwxr-xr-xplugins.d/charts.d.plugin9
-rwxr-xr-xplugins.d/fping.plugin4
-rwxr-xr-xplugins.d/node.d.plugin6
-rwxr-xr-xplugins.d/python.d.plugin7
-rwxr-xr-xplugins.d/tc-qos-helper.sh9
8 files changed, 24 insertions, 19 deletions
diff --git a/plugins.d/alarm-notify.sh b/plugins.d/alarm-notify.sh
index ab33eadb85..2932aac108 100755
--- a/plugins.d/alarm-notify.sh
+++ b/plugins.d/alarm-notify.sh
@@ -122,8 +122,8 @@ custom_sender() {
# -----------------------------------------------------------------------------
# defaults to allow running this script by hand
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
-NETDATA_CACHE_DIR="${NETDATA_CACHE_DIR-/var/cache/netdata}"
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
+[ -z "${NETDATA_CACHE_DIR}" ] && NETDATA_CACHE_DIR="$(dirname "${0}")/../../../../var/cache/netdata"
[ -z "${NETDATA_REGISTRY_URL}" ] && NETDATA_REGISTRY_URL="https://registry.my-netdata.io"
# -----------------------------------------------------------------------------
diff --git a/plugins.d/alarm-test.sh b/plugins.d/alarm-test.sh
index 1963111a53..9df5361a90 100755
--- a/plugins.d/alarm-test.sh
+++ b/plugins.d/alarm-test.sh
@@ -2,7 +2,7 @@
# netdata
# real-time performance and health monitoring, done right!
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
# GPL v3+
#
# Script to test alarm notifications for netdata
diff --git a/plugins.d/cgroup-name.sh b/plugins.d/cgroup-name.sh
index e17193edaa..40a87497c3 100755
--- a/plugins.d/cgroup-name.sh
+++ b/plugins.d/cgroup-name.sh
@@ -51,7 +51,7 @@ debug() {
# -----------------------------------------------------------------------------
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
CONFIG="${NETDATA_CONFIG_DIR}/cgroups-names.conf"
CGROUP="${1}"
NAME=
diff --git a/plugins.d/charts.d.plugin b/plugins.d/charts.d.plugin
index 00206f95f9..eda5c0de49 100755
--- a/plugins.d/charts.d.plugin
+++ b/plugins.d/charts.d.plugin
@@ -2,7 +2,7 @@
# netdata
# real-time performance and health monitoring, done right!
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
# GPL v3+
#
# charts.d.plugin allows easy development of BASH plugins
@@ -115,10 +115,11 @@ info "started from '$PROGRAM_FILE' with options: $*"
# internal defaults
# netdata exposes a few environment variables for us
-pluginsd="${NETDATA_PLUGINS_DIR}"
-[ -z "$pluginsd" ] && pluginsd="$( dirname $PROGRAM_FILE )"
+[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
-confd="${NETDATA_CONFIG_DIR-/etc/netdata}"
+pluginsd="${NETDATA_PLUGINS_DIR}"
+confd="${NETDATA_CONFIG_DIR}"
chartsd="$pluginsd/../charts.d"
myconfig="$confd/$PROGRAM_NAME.conf"
diff --git a/plugins.d/fping.plugin b/plugins.d/fping.plugin
index b43243ff12..b6d981a85f 100755
--- a/plugins.d/fping.plugin
+++ b/plugins.d/fping.plugin
@@ -2,7 +2,7 @@
# netdata
# real-time performance and health monitoring, done right!
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
# GPL v3+
#
# This plugin requires a latest version of fping.
@@ -129,7 +129,7 @@ update_every="${1-1}"
# the netdata configuration directory
# passed by netdata as an environment variable
-NETDATA_CONFIG_DIR="${NETDATA_CONFIG_DIR-/etc/netdata}"
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
# -----------------------------------------------------------------------------
# configuration options
diff --git a/plugins.d/node.d.plugin b/plugins.d/node.d.plugin
index 8b7047fcbb..b16203912d 100755
--- a/plugins.d/node.d.plugin
+++ b/plugins.d/node.d.plugin
@@ -4,13 +4,13 @@
// shebang hack from:
// http://unix.stackexchange.com/questions/65235/universal-node-js-shebang
-// Initially this is run as a shell script (#!/bin/sh).
+// Initially this is run as a shell script.
// Then, the second line, finds nodejs or node or js in the system path
// and executes it with the shell parameters.
// netdata
// real-time performance and health monitoring, done right!
-// (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+// (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
// GPL v3+
// --------------------------------------------------------------------------------------------------------------------
@@ -21,7 +21,7 @@
// get NETDATA environment variables
var NETDATA_PLUGINS_DIR = process.env.NETDATA_PLUGINS_DIR || __dirname;
-var NETDATA_CONFIG_DIR = process.env.NETDATA_CONFIG_DIR || '/etc/netdata';
+var NETDATA_CONFIG_DIR = process.env.NETDATA_CONFIG_DIR || __dirname + '/../../../../etc/netdata';
var NETDATA_UPDATE_EVERY = process.env.NETDATA_UPDATE_EVERY || 1;
var NODE_D_DIR = NETDATA_PLUGINS_DIR + '/../node.d';
diff --git a/plugins.d/python.d.plugin b/plugins.d/python.d.plugin
index 218c2b3ddd..4a598db58a 100755
--- a/plugins.d/python.d.plugin
+++ b/plugins.d/python.d.plugin
@@ -20,8 +20,11 @@ BASE_CONFIG = {'update_every': os.getenv('NETDATA_UPDATE_EVERY', 1),
'retries': 10}
MODULES_DIR = os.path.abspath(os.getenv('NETDATA_PLUGINS_DIR',
- os.path.dirname(__file__)) + "/../python.d") + "/"
-CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR', "/etc/netdata/")
+ os.path.dirname(__file__)) + "/../python.d") + "/"
+
+CONFIG_DIR = os.getenv('NETDATA_CONFIG_DIR',
+ os.path.dirname(__file__)) + "/../../../../etc/netdata")
+
# directories should end with '/'
if CONFIG_DIR[-1] != "/":
CONFIG_DIR += "/"
diff --git a/plugins.d/tc-qos-helper.sh b/plugins.d/tc-qos-helper.sh
index 074fece9a5..9153f22e2e 100755
--- a/plugins.d/tc-qos-helper.sh
+++ b/plugins.d/tc-qos-helper.sh
@@ -2,7 +2,7 @@
# netdata
# real-time performance and health monitoring, done right!
-# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
# GPL v3+
#
# This script is a helper to allow netdata collect tc data.
@@ -101,10 +101,11 @@ debug() {
# -----------------------------------------------------------------------------
-plugins_dir="${NETDATA_PLUGINS_DIR}"
-[ -z "$plugins_dir" ] && plugins_dir="$( dirname $PROGRAM_FILE )"
+[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
+[ -z "${NETDATA_CONFIG_DIR}" ] && NETDATA_CONFIG_DIR="$(dirname "${0}")/../../../../etc/netdata"
-config_dir=${NETDATA_CONFIG_DIR-/etc/netdata}
+plugins_dir="${NETDATA_PLUGINS_DIR}"
+config_dir="${NETDATA_CONFIG_DIR}"
tc="$(which tc 2>/dev/null || command -v tc 2>/dev/null)"