summaryrefslogtreecommitdiffstats
path: root/charts.d
diff options
context:
space:
mode:
Diffstat (limited to 'charts.d')
-rw-r--r--charts.d/Makefile.in25
-rwxr-xr-xcharts.d/ap.chart.sh11
-rwxr-xr-xcharts.d/apache.chart.sh28
-rwxr-xr-xcharts.d/apcupsd.chart.sh18
-rwxr-xr-xcharts.d/cpu_apps.chart.sh7
-rwxr-xr-xcharts.d/cpufreq.chart.sh11
-rwxr-xr-xcharts.d/example.chart.sh9
-rw-r--r--charts.d/exim.chart.sh47
-rwxr-xr-xcharts.d/hddtemp.chart.sh10
-rwxr-xr-xcharts.d/load_average.chart.sh6
-rwxr-xr-xcharts.d/mem_apps.chart.sh8
-rwxr-xr-xcharts.d/mysql.chart.sh24
-rwxr-xr-xcharts.d/nginx.chart.sh14
-rwxr-xr-xcharts.d/nut.chart.sh18
-rwxr-xr-xcharts.d/opensips.chart.sh12
-rwxr-xr-xcharts.d/phpfpm.chart.sh22
-rwxr-xr-xcharts.d/postfix.chart.sh26
-rwxr-xr-xcharts.d/sensors.chart.sh15
-rwxr-xr-xcharts.d/squid.chart.sh14
-rwxr-xr-xcharts.d/tomcat.chart.sh20
20 files changed, 222 insertions, 123 deletions
diff --git a/charts.d/Makefile.in b/charts.d/Makefile.in
index fabbb6dde..ef63f78f3 100644
--- a/charts.d/Makefile.in
+++ b/charts.d/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.15 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -16,7 +16,17 @@
VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
@@ -80,18 +90,19 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = charts.d
-DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(dist_charts_SCRIPTS) $(dist_charts_DATA)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___atomic.m4 \
$(top_srcdir)/m4/ax_c__generic.m4 \
$(top_srcdir)/m4/ax_c_mallinfo.m4 \
$(top_srcdir)/m4/ax_c_mallopt.m4 \
$(top_srcdir)/m4/ax_check_compile_flag.m4 \
+ $(top_srcdir)/m4/ax_gcc_func_attribute.m4 \
$(top_srcdir)/m4/ax_pthread.m4 $(top_srcdir)/m4/jemalloc.m4 \
$(top_srcdir)/m4/tcmalloc.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(dist_charts_SCRIPTS) \
+ $(dist_charts_DATA) $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@@ -146,6 +157,7 @@ am__can_run_installinfo = \
esac
DATA = $(dist_charts_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -329,7 +341,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu charts.d/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu charts.d/Makefile
-.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@@ -559,6 +570,8 @@ uninstall-am: uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS
pdf-am ps ps-am tags-am uninstall uninstall-am \
uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS
+.PRECIOUS: Makefile
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/charts.d/ap.chart.sh b/charts.d/ap.chart.sh
index 7b4f690bb..0e85c486d 100755
--- a/charts.d/ap.chart.sh
+++ b/charts.d/ap.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# _update_every is a special variable - it holds the number of seconds
# between the calls of the _update() function
ap_update_every=
@@ -7,13 +13,11 @@ ap_priority=6900
declare -A ap_devs=()
-export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/sbin"
-
# _check is called once, to find out if this chart should be enabled or not
ap_check() {
require_cmd iw || return 1
- local ev=$(iw dev | awk '
+ local ev=$(run iw dev | awk '
BEGIN {
i = "";
ssid = "";
@@ -43,6 +47,7 @@ ap_check() {
# - 1 to disable the chart
[ ${#ap_devs[@]} -gt 0 ] && return 0
+ error "no devices found in AP mode, with 'iw dev'"
return 1
}
diff --git a/charts.d/apache.chart.sh b/charts.d/apache.chart.sh
index 2d68d43b2..b503e74e3 100755
--- a/charts.d/apache.chart.sh
+++ b/charts.d/apache.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# the URL to download apache status info
apache_url="http://127.0.0.1:80/server-status?auto"
apache_curl_opts=
@@ -67,14 +73,14 @@ apache_detect() {
# we will not check of the Conns*
# keys, since these are apache 2.4 specific
- [ -z "${apache_key_accesses}" ] && echo >&2 "apache: missing 'Total Accesses' from apache server: ${*}" && return 1
- [ -z "${apache_key_kbytes}" ] && echo >&2 "apache: missing 'Total kBytes' from apache server: ${*}" && return 1
- [ -z "${apache_key_reqpersec}" ] && echo >&2 "apache: missing 'ReqPerSec' from apache server: ${*}" && return 1
- [ -z "${apache_key_bytespersec}" ] && echo >&2 "apache: missing 'BytesPerSec' from apache server: ${*}" && return 1
- [ -z "${apache_key_bytesperreq}" ] && echo >&2 "apache: missing 'BytesPerReq' from apache server: ${*}" && return 1
- [ -z "${apache_key_busyworkers}" ] && echo >&2 "apache: missing 'BusyWorkers' from apache server: ${*}" && return 1
- [ -z "${apache_key_idleworkers}" ] && echo >&2 "apache: missing 'IdleWorkers' from apache server: ${*}" && return 1
- [ -z "${apache_key_scoreboard}" ] && echo >&2 "apache: missing 'Scoreboard' from apache server: ${*}" && return 1
+ [ -z "${apache_key_accesses}" ] && error "missing 'Total Accesses' from apache server: ${*}" && return 1
+ [ -z "${apache_key_kbytes}" ] && error "missing 'Total kBytes' from apache server: ${*}" && return 1
+ [ -z "${apache_key_reqpersec}" ] && error "missing 'ReqPerSec' from apache server: ${*}" && return 1
+ [ -z "${apache_key_bytespersec}" ] && error "missing 'BytesPerSec' from apache server: ${*}" && return 1
+ [ -z "${apache_key_bytesperreq}" ] && error "missing 'BytesPerReq' from apache server: ${*}" && return 1
+ [ -z "${apache_key_busyworkers}" ] && error "missing 'BusyWorkers' from apache server: ${*}" && return 1
+ [ -z "${apache_key_idleworkers}" ] && error "missing 'IdleWorkers' from apache server: ${*}" && return 1
+ [ -z "${apache_key_scoreboard}" ] && error "missing 'Scoreboard' from apache server: ${*}" && return 1
if [ ! -z "${apache_key_connstotal}" \
-a ! -z "${apache_key_connsasyncwriting}" \
@@ -92,7 +98,7 @@ apache_detect() {
apache_get() {
local oIFS="${IFS}" ret
- IFS=$':\n' apache_response=($(curl -Ss ${apache_curl_opts} "${apache_url}"))
+ IFS=$':\n' apache_response=($(run curl -Ss ${apache_curl_opts} "${apache_url}"))
ret=$?
IFS="${oIFS}"
@@ -130,7 +136,7 @@ apache_get() {
-o -z "${apache_idleworkers}" \
]
then
- echo >&2 "apache: empty values got from apache server: ${apache_response[*]}"
+ error "empty values got from apache server: ${apache_response[*]}"
return 1
fi
@@ -151,7 +157,7 @@ apache_check() {
apache_get
if [ $? -ne 0 ]
then
- 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"
+ error "cannot find stub_status on URL '${apache_url}'. Please set apache_url='http://apache.server:80/server-status?auto' in $confd/apache.conf"
return 1
fi
diff --git a/charts.d/apcupsd.chart.sh b/charts.d/apcupsd.chart.sh
index df18aaa2e..46a86101c 100755
--- a/charts.d/apcupsd.chart.sh
+++ b/charts.d/apcupsd.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
apcupsd_ip=127.0.0.1
apcupsd_port=3551
@@ -12,7 +18,7 @@ apcupsd_timeout=3
apcupsd_priority=90000
apcupsd_get() {
- timeout $apcupsd_timeout apcaccess status "$1:$2"
+ run -t $apcupsd_timeout apcaccess status "$1:$2"
}
apcupsd_check() {
@@ -23,14 +29,14 @@ apcupsd_check() {
require_cmd apcaccess || return 1
- apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
+ run apcupsd_get $apcupsd_ip $apcupsd_port >/dev/null
if [ $? -ne 0 ]
then
- echo >&2 "apcupsd: ERROR: Cannot get information for apcupsd server."
+ error "cannot get information for apcupsd server."
return 1
elif [ $(apcupsd_get $apcupsd_ip $apcupsd_port | awk '/^STATUS.*/{ print $3 }') != "ONLINE" ]
then
- echo >&2 "apcupsd: ERROR: UPS not online."
+ error "APC UPS not online."
return 1
fi
@@ -62,7 +68,7 @@ DIMENSION output_voltage_nominal nominal absolute 1 100
CHART apcupsd.load '' "UPS Load" "percentage" ups apcupsd.load area $((apcupsd_priority)) $apcupsd_update_every
DIMENSION load load absolute 1 100
-CHART apcupsd.temp '' "UPS Temperature" "Celcius" ups apcupsd.temperature line $((apcupsd_priority + 7)) $apcupsd_update_every
+CHART apcupsd.temp '' "UPS Temperature" "Celsius" ups apcupsd.temperature line $((apcupsd_priority + 7)) $apcupsd_update_every
DIMENSION temp temp absolute 1 100
CHART apcupsd.time '' "UPS Time Remaining" "Minutes" ups apcupsd.time area $((apcupsd_priority + 2)) $apcupsd_update_every
@@ -146,7 +152,7 @@ END {
print \"SET time = \" time;
print \"END\"
}"
- [ $? -ne 0 ] && echo >&2 "apcupsd: failed to get values" && return 1
+ [ $? -ne 0 ] && error "failed to get values" && return 1
return 0
}
diff --git a/charts.d/cpu_apps.chart.sh b/charts.d/cpu_apps.chart.sh
index 6b2513dcf..8e075831a 100755
--- a/charts.d/cpu_apps.chart.sh
+++ b/charts.d/cpu_apps.chart.sh
@@ -1,5 +1,10 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
# THIS PLUGIN IS OBSOLETE
# USE apps.plugin INSTEAD
@@ -19,7 +24,7 @@ cpu_apps_check() {
if [ -z "$cpu_apps_apps" ]
then
- echo >&2 "$PROGRAM_NAME: cpu_apps: Please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
+ error "manual configuration required: please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
return 1
fi
return 0
diff --git a/charts.d/cpufreq.chart.sh b/charts.d/cpufreq.chart.sh
index 06f692fa6..b21504a0e 100755
--- a/charts.d/cpufreq.chart.sh
+++ b/charts.d/cpufreq.chart.sh
@@ -1,9 +1,15 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# if this chart is called X.chart.sh, then all functions and global variables
# must start with X_
-cpufreq_sys_dir="/sys/devices"
+cpufreq_sys_dir="${NETDATA_HOST_PREFIX}/sys/devices"
cpufreq_sys_depth=10
cpufreq_source_update=1
@@ -51,7 +57,7 @@ cpufreq_create() {
id="$( fixid "cpu$cpu" )"
- echo >&2 "charts.d: cpufreq: on file='$file', dir='$dir', cpu='$cpu', id='$id'"
+ debug "file='$file', dir='$dir', cpu='$cpu', id='$id'"
echo "DIMENSION $id '$id' absolute 1 1000"
echo >>$TMP_DIR/cpufreq.sh "echo \"SET $id = \"\$(< $file )"
@@ -59,7 +65,6 @@ cpufreq_create() {
echo >>$TMP_DIR/cpufreq.sh "echo END"
[ $cpufreq_source_update -eq 1 ] && echo >>$TMP_DIR/cpufreq.sh "}"
- # cat >&2 $TMP_DIR/cpufreq.sh
# ok, load the function cpufreq_update() we created
[ $cpufreq_source_update -eq 1 ] && . $TMP_DIR/cpufreq.sh
diff --git a/charts.d/example.chart.sh b/charts.d/example.chart.sh
index 93f1cf4fd..86fde4901 100755
--- a/charts.d/example.chart.sh
+++ b/charts.d/example.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# if this chart is called X.chart.sh, then all functions and global variables
# must start with X_
@@ -67,7 +73,7 @@ example_check() {
# - 1 to disable the chart
# check something
- [ "${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
+ [ "${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
# check that we can collect data
example_get || return 1
@@ -108,7 +114,6 @@ BEGIN example.random2 $1
SET random = $example_value4
END
VALUESEOF
- # echo >&2 "example_count = $example_count value = $value4"
return 0
}
diff --git a/charts.d/exim.chart.sh b/charts.d/exim.chart.sh
index c60ae9460..4c70f2c19 100644
--- a/charts.d/exim.chart.sh
+++ b/charts.d/exim.chart.sh
@@ -1,5 +1,13 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+# Contributed by @jsveiga with PR #480
+
+# the exim command to run
exim_command=
# how frequently to collect queue size
@@ -8,28 +16,15 @@ exim_update_every=5
exim_priority=60000
exim_check() {
- if [ -z "$exim_command" -o ! -x "$exim_command" ]
- then
- local d=
- for d in /sbin /usr/sbin /usr/local/sbin
- do
- if [ -x "$d/exim" ]
- then
- exim_command="$d/exim"
- break
- fi
- done
- fi
-
- if [ -z "$exim_command" -o ! -x "$exim_command" ]
- then
- echo >&2 "$PROGRAM_NAME: exim: cannot find exim executable. Please set 'exim_command=/path/to/exim' in $confd/exim.conf"
- return 1
- fi
+ if [ -z "${exim_command}" ]
+ then
+ require_cmd exim || return 1
+ exim_command="${EXIM_CMD}"
+ fi
- if [ `$exim_command -bpc 2>&1 | grep -c denied` -ne 0 ]
+ if [ $(${exim_command} -bpc 2>&1 | grep -c denied) -ne 0 ]
then
- echo >&2 "$PROGRAM_NAME: exim: permission denied. Please set 'queue_list_requires_admin = false' in your exim options file"
+ error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file"
return 1
fi
@@ -37,16 +32,16 @@ exim_check() {
}
exim_create() {
-cat <<EOF
+ cat <<EOF
CHART exim_local.qemails '' "Exim Queue Emails" "emails" queue exim.queued.emails line $((exim_priority + 1)) $exim_update_every
DIMENSION emails '' absolute 1 1
EOF
-return 0
+ return 0
}
exim_update() {
-echo "BEGIN exim_local.qemails $1"
-echo "SET emails = " `$exim_command -bpc`
-echo "END"
-return 0
+ echo "BEGIN exim_local.qemails $1"
+ echo "SET emails = " $(run ${exim_command} -bpc)
+ echo "END"
+ return 0
}
diff --git a/charts.d/hddtemp.chart.sh b/charts.d/hddtemp.chart.sh
index 41c3e2478..15895c5e1 100755
--- a/charts.d/hddtemp.chart.sh
+++ b/charts.d/hddtemp.chart.sh
@@ -1,5 +1,12 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+# contributed by @paulfantom with PR #511
+
# if this chart is called X.chart.sh, then all functions and global variables
# must start with X_
hddtemp_host="localhost"
@@ -13,7 +20,8 @@ hddtemp_priority=90000
# _check is called once, to find out if this chart should be enabled or not
hddtemp_check() {
- nc $hddtemp_host $hddtemp_port &>/dev/null && return 0 || return 1
+ require_cmd nc || return 1
+ run nc $hddtemp_host $hddtemp_port && return 0 || return 1
}
# _create is called once, to create the charts
diff --git a/charts.d/load_average.chart.sh b/charts.d/load_average.chart.sh
index e6790d807..70d3aec7a 100755
--- a/charts.d/load_average.chart.sh
+++ b/charts.d/load_average.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
load_average_update_every=5
load_priority=100
diff --git a/charts.d/mem_apps.chart.sh b/charts.d/mem_apps.chart.sh
index ab95b361c..3bc65fe24 100755
--- a/charts.d/mem_apps.chart.sh
+++ b/charts.d/mem_apps.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
mem_apps_apps=
# these are required for computing memory in bytes and cpu in seconds
@@ -15,7 +21,7 @@ mem_apps_check() {
if [ -z "$mem_apps_apps" ]
then
- echo >&2 "$PROGRAM_NAME: mem_apps: not configured. Please set mem_apps_apps='command1 command2 ...' in $confd/mem_apps_apps.conf"
+ error "manual configuration required: please set mem_apps_apps='command1 command2 ...' in $confd/mem_apps_apps.conf"
return 1
fi
return 0
diff --git a/charts.d/mysql.chart.sh b/charts.d/mysql.chart.sh
index 120fec66e..1363d01f4 100755
--- a/charts.d/mysql.chart.sh
+++ b/charts.d/mysql.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html
#
# https://dev.mysql.com/doc/refman/5.1/en/show-status.html
@@ -17,9 +23,9 @@ mysql_get() {
local oIFS="${IFS}"
mysql_data=()
IFS=$'\t'$'\n'
- #arr=($("${@}" -e "SHOW GLOBAL STATUS WHERE value REGEXP '^[0-9]';" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)" ))
- #arr=($("${@}" -N -e "SHOW GLOBAL STATUS;" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^ ]+\s[0-9]" ))
- arr=($("${@}" -N -e "SHOW GLOBAL STATUS;" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^[:space:]]+[[:space:]]+[0-9]+" ))
+ #arr=($(run "${@}" -e "SHOW GLOBAL STATUS WHERE value REGEXP '^[0-9]';" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)" ))
+ #arr=($(run "${@}" -N -e "SHOW GLOBAL STATUS;" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^ ]+\s[0-9]" ))
+ arr=($(run "${@}" -N -e "SHOW GLOBAL STATUS;" | egrep "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^[:space:]]+[[:space:]]+[0-9]+" ))
IFS="${oIFS}"
[ "${#arr[@]}" -lt 3 ] && return 1
@@ -49,7 +55,7 @@ mysql_check() {
shift
fi
- [ -z "${mysql_cmd}" ] && mysql_cmd="$(which mysql)"
+ [ -z "${mysql_cmd}" ] && mysql_cmd="$(which mysql 2>/dev/null || command -v mysql 2>/dev/null)"
if [ ${#mysql_opts[@]} -eq 0 ]
then
@@ -74,13 +80,13 @@ mysql_check() {
[ -z "${mysql_cmds[$m]}" ] && mysql_cmds[$m]="$mysql_cmd"
if [ -z "${mysql_cmds[$m]}" ]
then
- echo >&2 "$PROGRAM_NAME: mysql: cannot get mysql command for '$m'. Please set mysql_cmds[$m]='/path/to/mysql', in $confd/mysql.conf"
+ error "cannot get mysql command for '$m'. Please set mysql_cmds[$m]='/path/to/mysql', in $confd/mysql.conf"
fi
mysql_get "${mysql_cmds[$m]}" ${mysql_opts[$m]}
if [ ! $? -eq 0 ]
then
- echo >&2 "$PROGRAM_NAME: mysql: cannot get global status for '$m'. Please set mysql_opts[$m]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
+ error "cannot get global status for '$m'. Please set mysql_opts[$m]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
unset mysql_cmds[$m]
unset mysql_opts[$m]
unset mysql_ids[$m]
@@ -97,7 +103,7 @@ mysql_check() {
mysql_check tryroot "${@}"
return $?
else
- echo >&2 "$PROGRAM_NAME: mysql: no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
+ error "no mysql servers found. Please set mysql_opts[name]='options' to whatever needed to get connected to the mysql server, in $confd/mysql.conf"
return 1
fi
fi
@@ -318,7 +324,7 @@ mysql_update() {
unset mysql_ids[$m]
unset mysql_opts[$m]
unset mysql_cmds[$m]
- echo >&2 "$PROGRAM_NAME: mysql: failed to get values for '$m', disabling it."
+ error "failed to get values for '$m', disabling it."
continue
fi
@@ -510,7 +516,7 @@ VALUESEOF
fi
done
- [ ${#mysql_ids[@]} -eq 0 ] && echo >&2 "$PROGRAM_NAME: mysql: no mysql servers left active." && return 1
+ [ ${#mysql_ids[@]} -eq 0 ] && error "no mysql servers left active." && return 1
return 0
}
diff --git a/charts.d/nginx.chart.sh b/charts.d/nginx.chart.sh
index a2a9b320f..0ae7d6307 100755
--- a/charts.d/nginx.chart.sh
+++ b/charts.d/nginx.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# if this chart is called X.chart.sh, then all functions and global variables
# must start with X_
@@ -20,7 +26,7 @@ nginx_reading=0
nginx_writing=0
nginx_waiting=0
nginx_get() {
- nginx_response=($(curl -Ss ${nginx_curl_opts} "${nginx_url}"))
+ nginx_response=($(run curl -Ss ${nginx_curl_opts} "${nginx_url}"))
[ $? -ne 0 -o "${#nginx_response[@]}" -eq 0 ] && return 1
if [ "${nginx_response[0]}" != "Active" \
@@ -34,7 +40,7 @@ nginx_get() {
-o "${nginx_response[14]}" != "Waiting:" \
]
then
- echo >&2 "nginx: Invalid response from nginx server: ${nginx_response[*]}"
+ error "Invalid response from nginx server: ${nginx_response[*]}"
return 1
fi
@@ -55,7 +61,7 @@ nginx_get() {
-o -z "${nginx_waiting}" \
]
then
- echo >&2 "nginx: empty values got from nginx server: ${nginx_response[*]}"
+ error "empty values got from nginx server: ${nginx_response[*]}"
return 1
fi
@@ -68,7 +74,7 @@ nginx_check() {
nginx_get
if [ $? -ne 0 ]
then
- echo >&2 "nginx: cannot find stub_status on URL '${nginx_url}'. Please set nginx_url='http://nginx.server/stub_status' in $confd/nginx.conf"
+ error "cannot find stub_status on URL '${nginx_url}'. Please set nginx_url='http://nginx.server/stub_status' in $confd/nginx.conf"
return 1
fi
diff --git a/charts.d/nut.chart.sh b/charts.d/nut.chart.sh
index 3c8e1c9d0..e0b1b4cf9 100755
--- a/charts.d/nut.chart.sh
+++ b/charts.d/nut.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# a space separated list of UPS names
# if empty, the list returned by 'upsc -l' will be used
nut_ups=
@@ -15,11 +21,11 @@ nut_priority=90000
declare -A nut_ids=()
nut_get_all() {
- timeout $nut_timeout upsc -l
+ run -t $nut_timeout upsc -l
}
nut_get() {
- timeout $nut_timeout upsc "$1"
+ run -t $nut_timeout upsc "$1"
}
nut_check() {
@@ -42,12 +48,12 @@ nut_check() {
nut_ids[$x]="$( fixid "$x" )"
continue
fi
- echo >&2 "nut: ERROR: Cannot get information for NUT UPS '$x'."
+ error "cannot get information for NUT UPS '$x'."
done
if [ ${#nut_ids[@]} -eq 0 ]
then
- echo >&2 "nut: Please set nut_ups='ups_name' in $confd/nut.conf"
+ error "Cannot find UPSes - please set nut_ups='ups_name' in $confd/nut.conf"
return 1
fi
@@ -179,9 +185,9 @@ END {
print \"SET temp = \" temp;
print \"END\"
}"
- [ $? -ne 0 ] && unset nut_ids[$i] && echo >&2 "nut: failed to get values for '$i', disabling it."
+ [ $? -ne 0 ] && unset nut_ids[$i] && error "failed to get values for '$i', disabling it."
done
- [ ${#nut_ids[@]} -eq 0 ] && echo >&2 "nut: no UPSes left active." && return 1
+ [ ${#nut_ids[@]} -eq 0 ] && error "no UPSes left active." && return 1
return 0
}
diff --git a/charts.d/opensips.chart.sh b/charts.d/opensips.chart.sh
index 779087e35..2a0249dae 100755
--- a/charts.d/opensips.chart.sh
+++ b/charts.d/opensips.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
opensips_opts="fifo get_statistics all"
opensips_cmd=
opensips_update_every=5
@@ -7,7 +13,7 @@ opensips_timeout=2
opensips_priority=80000
opensips_get_stats() {
- timeout $opensips_timeout "$opensips_cmd" $opensips_opts |\
+ run -t $opensips_timeout "$opensips_cmd" $opensips_opts |\
grep "^\(core\|dialog\|net\|registrar\|shmem\|siptrace\|sl\|tm\|uri\|usrloc\):[a-zA-Z0-9_-]\+[[:space:]]*[=:]\+[[:space:]]*[0-9]\+[[:space:]]*$" |\
sed \
-e "s|[[:space:]]*[=:]\+[[:space:]]*\([0-9]\+\)[[:space:]]*$|=\1|g" \
@@ -31,7 +37,7 @@ opensips_check() {
local x="$(opensips_get_stats | grep "^opensips_core_")"
if [ ! $? -eq 0 -o -z "$x" ]
then
- echo >&2 "$PROGRAM_NAME: opensips: cannot get global status. Please set opensips_opts='options' whatever needed to get connected to opensips server, in $confd/opensips.conf"
+ error "cannot get global status. Please set opensips_opts='options' whatever needed to get connected to opensips server, in $confd/opensips.conf"
return 1
fi
@@ -214,7 +220,7 @@ opensips_update() {
eval "local $(opensips_get_stats)"
[ $? -ne 0 ] && return 1
- [ $opensips_command_failed -eq 1 ] && echo >&2 "$PROGRAM_NAME: opensips: failed to get values, disabling." && return 1
+ [ $opensips_command_failed -eq 1 ] && error "failed to get values, disabling." && return 1
# write the result of the work.
cat <<VALUESEOF
diff --git a/charts.d/phpfpm.chart.sh b/charts.d/phpfpm.chart.sh
index 976ce91b1..a5ee0ad56 100755
--- a/charts.d/phpfpm.chart.sh
+++ b/charts.d/phpfpm.chart.sh
@@ -1,9 +1,13 @@
# no need for shebang - this file is loaded from charts.d.plugin
-# if this chart is called X.chart.sh, then all functions and global variables
-# must start with X_
-
-# first, you need open php-fpm status in php-fpm.conf
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+# Contributed by @safeie with PR #276
+
+# first, you need open php-fpm status in php-fpm.conf
# second, you need add status location in nginx.conf
# you can see, https://easyengine.io/tutorials/php/fpm-status-page/
@@ -32,7 +36,7 @@ phpfpm_slow_requests=0
phpfpm_get() {
local opts="${1}" url="${2}"
- phpfpm_response=($(curl -Ss ${opts} "${url}"))
+ phpfpm_response=($(run curl -Ss ${opts} "${url}"))
[ $? -ne 0 -o "${#phpfpm_response[@]}" -eq 0 ] && return 1
if [[ "${phpfpm_response[0]}" != "pool:" \
@@ -46,7 +50,7 @@ phpfpm_get() {
|| "${phpfpm_response[32]}" != "total" \
]]
then
- echo >&2 "phpfpm: invalid response from phpfpm status server: ${phpfpm_response[*]}"
+ error "invalid response from phpfpm status server: ${phpfpm_response[*]}"
return 1
fi
@@ -83,7 +87,7 @@ phpfpm_get() {
|| -z "${phpfpm_max_children_reached}" \
]]
then
- echo >&2 "phpfpm: empty values got from phpfpm status server: ${phpfpm_response[*]}"
+ error "empty values got from phpfpm status server: ${phpfpm_response[*]}"
return 1
fi
@@ -101,14 +105,14 @@ phpfpm_check() {
do
phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
if [ $? -ne 0 ]; then
- echo >&2 "phpfpm: cannot find status on URL '${phpfpm_url[$m]}'. Please set phpfpm_urls[$m]='http://localhost/status' in $confd/phpfpm.conf"
+ error "cannot find status on URL '${phpfpm_url[$m]}'. Please set phpfpm_urls[$m]='http://localhost/status' in $confd/phpfpm.conf"
unset phpfpm_urls[$m]
continue
fi
done
if [ ${#phpfpm_urls[@]} -eq 0 ]; then
- echo >&2 "phpfpm: no phpfpm servers found. Please set phpfpm_urls[name]='url' to whatever needed to get status to the phpfpm server, in $confd/phpfpm.conf"
+ error "no phpfpm servers found. Please set phpfpm_urls[name]='url' to whatever needed to get status to the phpfpm server, in $confd/phpfpm.conf"
return 1
fi
diff --git a/charts.d/postfix.chart.sh b/charts.d/postfix.chart.sh
index 7f07a1868..85604fcbe 100755
--- a/charts.d/postfix.chart.sh
+++ b/charts.d/postfix.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# the postqueue command
# if empty, it will use the one found in the system path
postfix_postqueue=
@@ -17,24 +23,12 @@ postfix_check() {
# try to find the postqueue executable
if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
then
- postfix_postqueue="`which postqueue 2>/dev/null`"
- if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
- then
- local d=
- for d in /sbin /usr/sbin /usr/local/sbin
- do
- if [ -x "$d/postqueue" ]
- then
- postfix_postqueue="$d/postqueue"
- break
- fi
- done
- fi
+ postfix_postqueue="$(which postqueue 2>/dev/null || command -v postqueue 2>/dev/null)"
fi
if [ -z "$postfix_postqueue" -o ! -x "$postfix_postqueue" ]
then
- echo >&2 "$PROGRAM_NAME: postfix: cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
+ error "cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
return 1
fi
@@ -73,10 +67,10 @@ postfix_update() {
postfix_q_emails=0
postfix_q_size=0
- eval "`$postfix_postqueue -p |\
+ eval "$(run $postfix_postqueue -p |\
grep "^--" |\
sed -e "s/-- \([0-9]\+\) Kbytes in \([0-9]\+\) Requests.$/local postfix_q_size=\1\nlocal postfix_q_emails=\2/g" |\
- egrep "^local postfix_q_(emails|size)=[0-9]+$"`"
+ egrep "^local postfix_q_(emails|size)=[0-9]+$")"
# write the result of the work.
cat <<VALUESEOF
diff --git a/charts.d/sensors.chart.sh b/charts.d/sensors.chart.sh
index 9652f896a..125c925da 100755
--- a/charts.d/sensors.chart.sh
+++ b/charts.d/sensors.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
# sensors docs
# https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
@@ -43,7 +49,7 @@ sensors_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- [ -z "$( sensors_find_all_files $sensors_sys_dir )" ] && echo >&2 "$PROGRAM_NAME: sensors: no sensors found in '$sensors_sys_dir'." && return 1
+ [ -z "$( sensors_find_all_files $sensors_sys_dir )" ] && error "no sensors found in '$sensors_sys_dir'." && return 1
return 0
}
@@ -64,7 +70,7 @@ sensors_check_files() {
[ $v -ne 0 ] && echo "$f" && continue
excluded=
- echo >&2 "$PROGRAM_NAME: sensors: $f gives zero values"
+ error "$f gives zero values"
done
}
@@ -83,7 +89,7 @@ sensors_check_temp_type() {
v=$(( v + 1 - 1 ))
[ $v -ne 0 ] && echo "$f" && continue
- echo >&2 "$PROGRAM_NAME: sensors: $f is disabled"
+ error "$f is disabled"
done
}
@@ -121,7 +127,7 @@ sensors_create() {
id="$( fixid "$device.$subsystem.$dir" )"
- echo >&2 "charts.d: sensors: on path='$path', dir='$dir', device='$device', subsystem='$subsystem', id='$id', name='$name'"
+ debug "path='$path', dir='$dir', device='$device', subsystem='$subsystem', id='$id', name='$name'"
for mode in temperature voltage fans power current energy humidity
do
@@ -221,7 +227,6 @@ sensors_create() {
done
[ $sensors_source_update -eq 1 ] && echo >>$TMP_DIR/sensors.sh "}"
- # cat >&2 $TMP_DIR/sensors.sh
# ok, load the function sensors_update() we created
[ $sensors_source_update -eq 1 ] && . $TMP_DIR/sensors.sh
diff --git a/charts.d/squid.chart.sh b/charts.d/squid.chart.sh
index 3e72ba6df..2c19c35d5 100755
--- a/charts.d/squid.chart.sh
+++ b/charts.d/squid.chart.sh
@@ -1,5 +1,11 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+
squid_host=
squid_port=
squid_url=
@@ -9,7 +15,7 @@ squid_priority=60000
squid_get_stats_internal() {
local host="$1" port="$2" url="$3"
- squidclient -h $host -p $port $url
+ run squidclient -h $host -p $port $url
}
squid_get_stats() {
@@ -29,13 +35,13 @@ squid_autodetect() {
squid_host="$host"
squid_port="$port"
squid_url="$url"
- echo >&2 "squid: found squid at '$host:$port' with url '$url'"
+ debug "found squid at '$host:$port' with url '$url'"
return 0
fi
done
done
- echo >&2 "squid: cannot find squid running in localhost. Please set squid_url='url' and squid_host='IP' and squid_port='PORT' in $confd/squid.conf"
+ error "cannot find squid running in localhost. Please set squid_url='url' and squid_host='IP' and squid_port='PORT' in $confd/squid.conf"
return 1
}
@@ -53,7 +59,7 @@ squid_check() {
local x="$(squid_get_stats | grep client_http.requests)"
if [ ! $? -eq 0 -o -z "$x" ]
then
- echo >&2 "squid: cannot fetch URL '$squid_url' by connecting to $squid_host:$squid_port. Please set squid_url='url' and squid_host='host' and squid_port='port' in $confd/squid.conf"
+ error "cannot fetch URL '$squid_url' by connecting to $squid_host:$squid_port. Please set squid_url='url' and squid_host='host' and squid_port='port' in $confd/squid.conf"
return 1
fi
diff --git a/charts.d/tomcat.chart.sh b/charts.d/tomcat.chart.sh
index cc6baea1a..44a92c86e 100755
--- a/charts.d/tomcat.chart.sh
+++ b/charts.d/tomcat.chart.sh
@@ -1,5 +1,12 @@
# no need for shebang - this file is loaded from charts.d.plugin
+# netdata
+# real-time performance and health monitoring, done right!
+# (C) 2016 Costa Tsaousis <costa@tsaousis.gr>
+# GPL v3+
+#
+# Contributed by @jgeromero with PR #277
+
# Description: Tomcat netdata charts.d plugin
# Author: Jorge Romero
@@ -34,13 +41,13 @@ tomcat_check() {
# check if url, username, passwords are set
if [ -z "${tomcat_url}" ]; then
- echo >&2 "tomcat url is unset or set to the empty string"
+ error "tomcat url is unset or set to the empty string"
return 1
fi
if [ -z "${tomcat_user}" ]; then
# check backwards compatibility
if [ -z "${tomcatUser}" ]; then
- echo >&2 "tomcat user is unset or set to the empty string"
+ error "tomcat user is unset or set to the empty string"
return 1
else
tomcat_user="${tomcatUser}"
@@ -49,7 +56,7 @@ tomcat_check() {
if [ -z "${tomcat_password}" ]; then
# check backwards compatibility
if [ -z "${tomcatPassword}" ]; then
- echo >&2 "tomcat password is unset or set to the empty string"
+ error "tomcat password is unset or set to the empty string"
return 1
else
tomcat_password="${tomcatPassword}"
@@ -60,8 +67,7 @@ tomcat_check() {
tomcat_get
if [ $? -ne 0 ]
then
- echo >&2 "tomcat: couldn't get to status page on URL '${tomcat_url}'."\
- "Please make sure tomcat url, username and password are correct."
+ error "cannot get to status page on URL '${tomcat_url}'. Please make sure tomcat url, username and password are correct."
return 1
fi
@@ -75,8 +81,8 @@ tomcat_check() {
tomcat_get() {
# collect tomcat values
tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")"
- mapfile -t lines < <(curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
- xmlstarlet sel \
+ mapfile -t lines < <(run curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
+ run xmlstarlet sel \
-t -m "/status/jvm/memory" -v @free \
-n -m "/status/connector[@name='\"http-bio-$tomcat_port\"']/threadInfo" -v @currentThreadCount \
-n -v @currentThreadsBusy \