@cryptotaxi247 / netdata-1 / commits / ce4eedac0

improved error logging when netdata cannot find fireqos class names

Costa Tsaousis (ktsaou) committed Mar 29, 2018 at 14:34 UTC ce4eedac0a844afc3bc49f17d9aed3e3a0d369d8
1 file changed +47 -42
plugins.d/tc-qos-helper.sh
+47 -42
@@ -13,6 +13,47 @@ export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
13 export LC_ALL=C
14
15
16 +# -----------------------------------------------------------------------------
17 +# logging functions
18 +
19 +PROGRAM_FILE="$0"
20 +PROGRAM_NAME="$(basename $0)"
21 +PROGRAM_NAME="${PROGRAM_NAME/.plugin}"
22 +
23 +logdate() {
24 + date "+%Y-%m-%d %H:%M:%S"
25 +}
26 +
27 +log() {
28 + local status="${1}"
29 + shift
30 +
31 + echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${*}"
32 +
33 +}
34 +
35 +warning() {
36 + log WARNING "${@}"
37 +}
38 +
39 +error() {
40 + log ERROR "${@}"
41 +}
42 +
43 +info() {
44 + log INFO "${@}"
45 +}
46 +
47 +fatal() {
48 + log FATAL "${@}"
49 + exit 1
50 +}
51 +
52 +debug=0
53 +debug() {
54 + [ $debug -eq 1 ] && log DEBUG "${@}"
55 +}
56 +
57 # -----------------------------------------------------------------------------
58 # find /var/run/fireqos
59
@@ -52,53 +93,17 @@ if [ ! -d "${fireqos_run_dir}" ]
93 if [ -d "${LOCALSTATEDIR}/run/fireqos" ]
94 then
95 fireqos_run_dir="${LOCALSTATEDIR}/run/fireqos"
96 + else
97 + warning "FireQoS is installed as '${fireqos}', its installation config at '${fireqos_exec_dir}/install.config' specifies local state data at '${LOCALSTATEDIR}/run/fireqos', but this directory is not found or is not readable (check the permissions of its parents)."
98 fi
99 + else
100 + warning "Although FireQoS is installed on this system as '${fireqos}', I cannot find/read its installation configuration at '${fireqos_exec_dir}/install.config'."
101 fi
102 + else
103 + warning "FireQoS is not installed on this system. Use FireQoS to apply traffic QoS and expose the class names to netdata. Check https://github.com/firehol/netdata/wiki/You-should-install-QoS-on-all-your-servers"
104 fi
105 fi
106
60 -# -----------------------------------------------------------------------------
61 -# logging functions
62 -
63 -PROGRAM_FILE="$0"
64 -PROGRAM_NAME="$(basename $0)"
65 -PROGRAM_NAME="${PROGRAM_NAME/.plugin}"
66 -
67 -logdate() {
68 - date "+%Y-%m-%d %H:%M:%S"
69 -}
70 -
71 -log() {
72 - local status="${1}"
73 - shift
74 -
75 - echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${*}"
76 -
77 -}
78 -
79 -warning() {
80 - log WARNING "${@}"
81 -}
82 -
83 -error() {
84 - log ERROR "${@}"
85 -}
86 -
87 -info() {
88 - log INFO "${@}"
89 -}
90 -
91 -fatal() {
92 - log FATAL "${@}"
93 - exit 1
94 -}
95 -
96 -debug=0
97 -debug() {
98 - [ $debug -eq 1 ] && log DEBUG "${@}"
99 -}
100 -
101 -
107 # -----------------------------------------------------------------------------
108
109 [ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"