Skip to content

Commit 0acd15d

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # python.d/python_modules/base.py # python.d/redis.chart.py
2 parents 7d5c114 + 2ba7db3 commit 0acd15d

146 files changed

Lines changed: 8616 additions & 3635 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ set(NETDATA_SOURCE_FILES
2626
src/global_statistics.h
2727
src/health.c
2828
src/health.h
29+
src/ipc.c
30+
src/ipc.h
2931
src/log.c
3032
src/log.h
3133
src/main.c

charts.d/ap.chart.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
# _update_every is a special variable - it holds the number of seconds
410
# between the calls of the _update() function
511
ap_update_every=
612
ap_priority=6900
713

814
declare -A ap_devs=()
915

10-
export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
11-
1216
# _check is called once, to find out if this chart should be enabled or not
1317
ap_check() {
1418
require_cmd iw || return 1
1519

16-
local ev=$(iw dev | awk '
20+
local ev=$(run iw dev | awk '
1721
BEGIN {
1822
i = "";
1923
ssid = "";
@@ -43,6 +47,7 @@ ap_check() {
4347
# - 1 to disable the chart
4448

4549
[ ${#ap_devs[@]} -gt 0 ] && return 0
50+
error "no devices found in AP mode, with 'iw dev'"
4651
return 1
4752
}
4853

charts.d/apache.chart.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
# the URL to download apache status info
410
apache_url="http://127.0.0.1:80/server-status?auto"
511
apache_curl_opts=
@@ -67,14 +73,14 @@ apache_detect() {
6773

6874
# we will not check of the Conns*
6975
# keys, since these are apache 2.4 specific
70-
[ -z "${apache_key_accesses}" ] && echo >&2 "apache: missing 'Total Accesses' from apache server: ${*}" && return 1
71-
[ -z "${apache_key_kbytes}" ] && echo >&2 "apache: missing 'Total kBytes' from apache server: ${*}" && return 1
72-
[ -z "${apache_key_reqpersec}" ] && echo >&2 "apache: missing 'ReqPerSec' from apache server: ${*}" && return 1
73-
[ -z "${apache_key_bytespersec}" ] && echo >&2 "apache: missing 'BytesPerSec' from apache server: ${*}" && return 1
74-
[ -z "${apache_key_bytesperreq}" ] && echo >&2 "apache: missing 'BytesPerReq' from apache server: ${*}" && return 1
75-
[ -z "${apache_key_busyworkers}" ] && echo >&2 "apache: missing 'BusyWorkers' from apache server: ${*}" && return 1
76-
[ -z "${apache_key_idleworkers}" ] && echo >&2 "apache: missing 'IdleWorkers' from apache server: ${*}" && return 1
77-
[ -z "${apache_key_scoreboard}" ] && echo >&2 "apache: missing 'Scoreboard' from apache server: ${*}" && return 1
76+
[ -z "${apache_key_accesses}" ] && error "missing 'Total Accesses' from apache server: ${*}" && return 1
77+
[ -z "${apache_key_kbytes}" ] && error "missing 'Total kBytes' from apache server: ${*}" && return 1
78+
[ -z "${apache_key_reqpersec}" ] && error "missing 'ReqPerSec' from apache server: ${*}" && return 1
79+
[ -z "${apache_key_bytespersec}" ] && error "missing 'BytesPerSec' from apache server: ${*}" && return 1
80+
[ -z "${apache_key_bytesperreq}" ] && error "missing 'BytesPerReq' from apache server: ${*}" && return 1
81+
[ -z "${apache_key_busyworkers}" ] && error "missing 'BusyWorkers' from apache server: ${*}" && return 1
82+
[ -z "${apache_key_idleworkers}" ] && error "missing 'IdleWorkers' from apache server: ${*}" && return 1
83+
[ -z "${apache_key_scoreboard}" ] && error "missing 'Scoreboard' from apache server: ${*}" && return 1
7884

7985
if [ ! -z "${apache_key_connstotal}" \
8086
-a ! -z "${apache_key_connsasyncwriting}" \
@@ -92,7 +98,7 @@ apache_detect() {
9298

9399
apache_get() {
94100
local oIFS="${IFS}" ret
95-
IFS=$':\n' apache_response=($(curl -Ss ${apache_curl_opts} "${apache_url}"))
101+
IFS=$':\n' apache_response=($(run curl -Ss ${apache_curl_opts} "${apache_url}"))
96102
ret=$?
97103
IFS="${oIFS}"
98104

@@ -130,7 +136,7 @@ apache_get() {
130136
-o -z "${apache_idleworkers}" \
131137
]
132138
then
133-
echo >&2 "apache: empty values got from apache server: ${apache_response[*]}"
139+
error "empty values got from apache server: ${apache_response[*]}"
134140
return 1
135141
fi
136142

@@ -151,7 +157,7 @@ apache_check() {
151157
apache_get
152158
if [ $? -ne 0 ]
153159
then
154-
echo >&2 "apache: cannot find stub_status on URL '${apache_url}'. Please set apache_url='http://apache.server:80/server-status?auto' in $confd/apache.conf"
160+
error "cannot find stub_status on URL '${apache_url}'. Please set apache_url='http://apache.server:80/server-status?auto' in $confd/apache.conf"
155161
return 1
156162
fi
157163

charts.d/apcupsd.chart.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
apcupsd_ip=127.0.0.1
410
apcupsd_port=3551
511

@@ -12,7 +18,7 @@ apcupsd_timeout=3
1218
apcupsd_priority=90000
1319

1420
apcupsd_get() {
15-
timeout $apcupsd_timeout apcaccess status "$1:$2"
21+
run -t $apcupsd_timeout apcaccess status "$1:$2"
1622
}
1723

1824
apcupsd_check() {
@@ -23,14 +29,14 @@ apcupsd_check() {
2329

2430
require_cmd apcaccess || return 1
2531

26-
apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
32+
run apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
2733
if [ $? -ne 0 ]
2834
then
29-
echo >&2 "apcupsd: ERROR: Cannot get information for apcupsd server."
35+
error "cannot get information for apcupsd server."
3036
return 1
3137
elif [ $(apcupsd_get $apcupsd_ip $apcupsd_port | awk '/^STATUS.*/{ print $3 }') != "ONLINE" ]
3238
then
33-
echo >&2 "apcupsd: ERROR: UPS not online."
39+
error "APC UPS not online."
3440
return 1
3541
fi
3642

@@ -146,7 +152,7 @@ END {
146152
print \"SET time = \" time;
147153
print \"END\"
148154
}"
149-
[ $? -ne 0 ] && echo >&2 "apcupsd: failed to get values" && return 1
155+
[ $? -ne 0 ] && error "failed to get values" && return 1
150156

151157
return 0
152158
}

charts.d/cpu_apps.chart.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
38
# THIS PLUGIN IS OBSOLETE
49
# USE apps.plugin INSTEAD
510

@@ -19,7 +24,7 @@ cpu_apps_check() {
1924

2025
if [ -z "$cpu_apps_apps" ]
2126
then
22-
echo >&2 "$PROGRAM_NAME: cpu_apps: Please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
27+
error "manual configuration required: please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
2328
return 1
2429
fi
2530
return 0

charts.d/cpufreq.chart.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
# if this chart is called X.chart.sh, then all functions and global variables
410
# must start with X_
511

@@ -51,15 +57,14 @@ cpufreq_create() {
5157

5258
id="$( fixid "cpu$cpu" )"
5359

54-
echo >&2 "charts.d: cpufreq: on file='$file', dir='$dir', cpu='$cpu', id='$id'"
60+
debug "file='$file', dir='$dir', cpu='$cpu', id='$id'"
5561

5662
echo "DIMENSION $id '$id' absolute 1 1000"
5763
echo >>$TMP_DIR/cpufreq.sh "echo \"SET $id = \"\$(< $file )"
5864
done
5965
echo >>$TMP_DIR/cpufreq.sh "echo END"
6066

6167
[ $cpufreq_source_update -eq 1 ] && echo >>$TMP_DIR/cpufreq.sh "}"
62-
# cat >&2 $TMP_DIR/cpufreq.sh
6368

6469
# ok, load the function cpufreq_update() we created
6570
[ $cpufreq_source_update -eq 1 ] && . $TMP_DIR/cpufreq.sh

charts.d/example.chart.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
# if this chart is called X.chart.sh, then all functions and global variables
410
# must start with X_
511

@@ -67,7 +73,7 @@ example_check() {
6773
# - 1 to disable the chart
6874

6975
# check something
70-
[ "${example_magic_number}" != "12345" ] && echo >&2 "example: you have to set example_magic_number=$example_magic_number in example.conf to start example chart." && return 1
76+
[ "${example_magic_number}" != "12345" ] && error "manual configuration required: you have to set example_magic_number=$example_magic_number in example.conf to start example chart." && return 1
7177

7278
# check that we can collect data
7379
example_get || return 1
@@ -108,7 +114,6 @@ BEGIN example.random2 $1
108114
SET random = $example_value4
109115
END
110116
VALUESEOF
111-
# echo >&2 "example_count = $example_count value = $value4"
112117

113118
return 0
114119
}

charts.d/exim.chart.sh

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
# Contributed by @jsveiga with PR #480
9+
10+
# the exim command to run
311
exim_command=
412

513
# how frequently to collect queue size
@@ -8,45 +16,32 @@ exim_update_every=5
816
exim_priority=60000
917

1018
exim_check() {
11-
if [ -z "$exim_command" -o ! -x "$exim_command" ]
12-
then
13-
local d=
14-
for d in /sbin /usr/sbin /usr/local/sbin
15-
do
16-
if [ -x "$d/exim" ]
17-
then
18-
exim_command="$d/exim"
19-
break
20-
fi
21-
done
22-
fi
23-
24-
if [ -z "$exim_command" -o ! -x "$exim_command" ]
25-
then
26-
echo >&2 "$PROGRAM_NAME: exim: cannot find exim executable. Please set 'exim_command=/path/to/exim' in $confd/exim.conf"
27-
return 1
28-
fi
19+
if [ -z "${exim_command}" ]
20+
then
21+
require_cmd exim || return 1
22+
exim_command="${EXIM_CMD}"
23+
fi
2924

30-
if [ `$exim_command -bpc 2>&1 | grep -c denied` -ne 0 ]
25+
if [ $(${exim_command} -bpc 2>&1 | grep -c denied) -ne 0 ]
3126
then
32-
echo >&2 "$PROGRAM_NAME: exim: permission denied. Please set 'queue_list_requires_admin = false' in your exim options file"
27+
error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file"
3328
return 1
3429
fi
3530

3631
return 0
3732
}
3833

3934
exim_create() {
40-
cat <<EOF
35+
cat <<EOF
4136
CHART exim_local.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every
4237
DIMENSION emails '' absolute 1 1
4338
EOF
44-
return 0
39+
return 0
4540
}
4641

4742
exim_update() {
48-
echo "BEGIN exim_local.qemails $1"
49-
echo "SET emails = " `$exim_command -bpc`
50-
echo "END"
51-
return 0
43+
echo "BEGIN exim_local.qemails $1"
44+
echo "SET emails = " $(run ${exim_command} -bpc)
45+
echo "END"
46+
return 0
5247
}

charts.d/hddtemp.chart.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
# contributed by @paulfantom with PR #511
9+
310
# if this chart is called X.chart.sh, then all functions and global variables
411
# must start with X_
512
hddtemp_host="localhost"
@@ -13,7 +20,8 @@ hddtemp_priority=90000
1320

1421
# _check is called once, to find out if this chart should be enabled or not
1522
hddtemp_check() {
16-
nc $hddtemp_host $hddtemp_port &>/dev/null && return 0 || return 1
23+
require_cmd nc || return 1
24+
run nc $hddtemp_host $hddtemp_port && return 0 || return 1
1725
}
1826

1927
# _create is called once, to create the charts

charts.d/load_average.chart.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# no need for shebang - this file is loaded from charts.d.plugin
22

3+
# netdata
4+
# real-time performance and health monitoring, done right!
5+
# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
6+
# GPL v3+
7+
#
8+
39
load_average_update_every=5
410
load_priority=100
511

0 commit comments

Comments
 (0)