summaryrefslogtreecommitdiffstats
path: root/collectors/charts.d.plugin
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:31:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-02-08 07:31:03 +0000
commit50485bedfd9818165aa1d039d0abe95a559134b7 (patch)
tree79c7b08f67edcfb0c936e7a22931653b91189b9f /collectors/charts.d.plugin
parentReleasing debian version 1.11.1+dfsg-7. (diff)
downloadnetdata-50485bedfd9818165aa1d039d0abe95a559134b7.tar.xz
netdata-50485bedfd9818165aa1d039d0abe95a559134b7.zip
Merging upstream version 1.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/charts.d.plugin')
-rw-r--r--collectors/charts.d.plugin/.keep0
-rw-r--r--collectors/charts.d.plugin/Makefile.am3
-rw-r--r--collectors/charts.d.plugin/Makefile.in953
-rw-r--r--collectors/charts.d.plugin/README.md2
-rw-r--r--collectors/charts.d.plugin/ap/README.md2
-rw-r--r--collectors/charts.d.plugin/ap/ap.chart.sh91
-rw-r--r--collectors/charts.d.plugin/apache/README.md8
-rw-r--r--collectors/charts.d.plugin/apache/apache.chart.sh79
-rw-r--r--collectors/charts.d.plugin/apcupsd/README.md7
-rw-r--r--collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh189
-rwxr-xr-xcollectors/charts.d.plugin/charts.d.dryrun-helper.sh58
-rw-r--r--collectors/charts.d.plugin/charts.d.plugin743
-rwxr-xr-xcollectors/charts.d.plugin/charts.d.plugin.in924
-rw-r--r--collectors/charts.d.plugin/cpu_apps/README.md6
-rw-r--r--collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh20
-rw-r--r--collectors/charts.d.plugin/cpufreq/README.md6
-rw-r--r--collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh18
-rw-r--r--collectors/charts.d.plugin/example/README.md4
-rw-r--r--collectors/charts.d.plugin/example/example.chart.sh15
-rw-r--r--collectors/charts.d.plugin/exim/README.md6
-rw-r--r--collectors/charts.d.plugin/exim/exim.chart.sh26
-rw-r--r--collectors/charts.d.plugin/hddtemp/README.md8
-rw-r--r--collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh24
-rw-r--r--collectors/charts.d.plugin/libreswan/README.md2
-rw-r--r--collectors/charts.d.plugin/libreswan/libreswan.chart.sh32
-rw-r--r--collectors/charts.d.plugin/load_average/README.md4
-rw-r--r--collectors/charts.d.plugin/load_average/load_average.chart.sh14
-rw-r--r--collectors/charts.d.plugin/loopsleepms.sh.inc282
-rw-r--r--collectors/charts.d.plugin/mem_apps/README.md6
-rw-r--r--collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh13
-rw-r--r--collectors/charts.d.plugin/mysql/README.md8
-rw-r--r--collectors/charts.d.plugin/mysql/mysql.chart.sh71
-rw-r--r--collectors/charts.d.plugin/nginx/README.md6
-rw-r--r--collectors/charts.d.plugin/nginx/nginx.chart.sh37
-rw-r--r--collectors/charts.d.plugin/nut/README.md2
-rw-r--r--collectors/charts.d.plugin/nut/nut.chart.sh35
-rw-r--r--collectors/charts.d.plugin/opensips/README.md7
-rw-r--r--collectors/charts.d.plugin/opensips/opensips.chart.sh10
-rw-r--r--collectors/charts.d.plugin/phpfpm/README.md6
-rw-r--r--collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh49
-rw-r--r--collectors/charts.d.plugin/postfix/README.md8
-rw-r--r--collectors/charts.d.plugin/postfix/postfix.chart.sh14
-rw-r--r--collectors/charts.d.plugin/sensors/README.md7
-rw-r--r--collectors/charts.d.plugin/sensors/sensors.chart.sh195
-rw-r--r--collectors/charts.d.plugin/squid/README.md9
-rw-r--r--collectors/charts.d.plugin/squid/squid.chart.sh20
-rw-r--r--collectors/charts.d.plugin/tomcat/README.md6
-rw-r--r--collectors/charts.d.plugin/tomcat/tomcat.chart.sh26
48 files changed, 1131 insertions, 2930 deletions
diff --git a/collectors/charts.d.plugin/.keep b/collectors/charts.d.plugin/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/collectors/charts.d.plugin/.keep
diff --git a/collectors/charts.d.plugin/Makefile.am b/collectors/charts.d.plugin/Makefile.am
index e2e00258..2989b4b8 100644
--- a/collectors/charts.d.plugin/Makefile.am
+++ b/collectors/charts.d.plugin/Makefile.am
@@ -32,12 +32,11 @@ dist_charts_DATA = \
userchartsconfigdir=$(configdir)/charts.d
dist_userchartsconfig_DATA = \
- $(top_srcdir)/installer/.keep \
+ .keep \
$(NULL)
chartsconfigdir=$(libconfigdir)/charts.d
dist_chartsconfig_DATA = \
- $(top_srcdir)/installer/.keep \
$(NULL)
include ap/Makefile.inc
diff --git a/collectors/charts.d.plugin/Makefile.in b/collectors/charts.d.plugin/Makefile.in
deleted file mode 100644
index 23e2edeb..00000000
--- a/collectors/charts.d.plugin/Makefile.in
+++ /dev/null
@@ -1,953 +0,0 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994-2013 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# THIS IS NOT A COMPLETE Makefile
-# IT IS INCLUDED BY ITS PARENT'S Makefile.am
-# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
-
-
-VPATH = @srcdir@
-am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
-am__make_running_with_option = \
- case $${target_option-} in \
- ?) ;; \
- *) echo "am__make_running_with_option: internal error: invalid" \
- "target option '$${target_option-}' specified" >&2; \
- exit 1;; \
- esac; \
- has_opt=no; \
- sane_makeflags=$$MAKEFLAGS; \
- if $(am__is_gnu_make); then \
- sane_makeflags=$$MFLAGS; \
- else \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- bs=\\; \
- sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
- | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
- esac; \
- fi; \
- skip_next=no; \
- strip_trailopt () \
- { \
- flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
- }; \
- for flg in $$sane_makeflags; do \
- test $$skip_next = yes && { skip_next=no; continue; }; \
- case $$flg in \
- *=*|--*) continue;; \
- -*I) strip_trailopt 'I'; skip_next=yes;; \
- -*I?*) strip_trailopt 'I';; \
- -*O) strip_trailopt 'O'; skip_next=yes;; \
- -*O?*) strip_trailopt 'O';; \
- -*l) strip_trailopt 'l'; skip_next=yes;; \
- -*l?*) strip_trailopt 'l';; \
- -[dEDm]) skip_next=yes;; \
- -[JT]) skip_next=yes;; \
- esac; \
- case $$flg in \
- *$$target_option*) has_opt=yes; break;; \
- esac; \
- done; \
- test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-DIST_COMMON = $(top_srcdir)/build/subst.inc $(srcdir)/ap/Makefile.inc \
- $(srcdir)/apache/Makefile.inc $(srcdir)/apcupsd/Makefile.inc \
- $(srcdir)/cpu_apps/Makefile.inc $(srcdir)/cpufreq/Makefile.inc \
- $(srcdir)/example/Makefile.inc $(srcdir)/exim/Makefile.inc \
- $(srcdir)/hddtemp/Makefile.inc \
- $(srcdir)/libreswan/Makefile.inc \
- $(srcdir)/load_average/Makefile.inc \
- $(srcdir)/mem_apps/Makefile.inc $(srcdir)/mysql/Makefile.inc \
- $(srcdir)/nginx/Makefile.inc $(srcdir)/nut/Makefile.inc \
- $(srcdir)/opensips/Makefile.inc $(srcdir)/phpfpm/Makefile.inc \
- $(srcdir)/postfix/Makefile.inc $(srcdir)/sensors/Makefile.inc \
- $(srcdir)/squid/Makefile.inc $(srcdir)/tomcat/Makefile.inc \
- $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
- $(dist_charts_SCRIPTS) $(dist_plugins_SCRIPTS) \
- $(dist_charts_DATA) $(dist_chartsconfig_DATA) \
- $(dist_libconfig_DATA) $(dist_noinst_DATA) \
- $(dist_userchartsconfig_DATA)
-subdir = collectors/charts.d.plugin
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/build/m4/ax_c___atomic.m4 \
- $(top_srcdir)/build/m4/ax_c__generic.m4 \
- $(top_srcdir)/build/m4/ax_c_lto.m4 \
- $(top_srcdir)/build/m4/ax_c_mallinfo.m4 \
- $(top_srcdir)/build/m4/ax_c_mallopt.m4 \
- $(top_srcdir)/build/m4/ax_check_compile_flag.m4 \
- $(top_srcdir)/build/m4/ax_gcc_func_attribute.m4 \
- $(top_srcdir)/build/m4/ax_pthread.m4 \
- $(top_srcdir)/build/m4/jemalloc.m4 \
- $(top_srcdir)/build/m4/tcmalloc.m4 $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__installdirs = "$(DESTDIR)$(chartsdir)" "$(DESTDIR)$(pluginsdir)" \
- "$(DESTDIR)$(chartsdir)" "$(DESTDIR)$(chartsconfigdir)" \
- "$(DESTDIR)$(libconfigdir)" "$(DESTDIR)$(userchartsconfigdir)"
-SCRIPTS = $(dist_charts_SCRIPTS) $(dist_plugins_SCRIPTS)
-AM_V_P = $(am__v_P_@AM_V@)
-am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_@AM_V@)
-am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
-am__v_GEN_0 = @echo " GEN " $@;
-am__v_GEN_1 =
-AM_V_at = $(am__v_at_@AM_V@)
-am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
-am__v_at_0 = @
-am__v_at_1 =
-SOURCES =
-DIST_SOURCES =
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-DATA = $(dist_charts_DATA) $(dist_chartsconfig_DATA) \
- $(dist_libconfig_DATA) $(dist_noinst_DATA) \
- $(dist_userchartsconfig_DATA)
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-IPMIMONITORING_CFLAGS = @IPMIMONITORING_CFLAGS@
-IPMIMONITORING_LIBS = @IPMIMONITORING_LIBS@
-LDFLAGS = @LDFLAGS@
-LIBCAP_CFLAGS = @LIBCAP_CFLAGS@
-LIBCAP_LIBS = @LIBCAP_LIBS@
-LIBMNL_CFLAGS = @LIBMNL_CFLAGS@
-LIBMNL_LIBS = @LIBMNL_LIBS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MATH_CFLAGS = @MATH_CFLAGS@
-MATH_LIBS = @MATH_LIBS@
-MKDIR_P = @MKDIR_P@
-NFACCT_CFLAGS = @NFACCT_CFLAGS@
-NFACCT_LIBS = @NFACCT_LIBS@
-OBJEXT = @OBJEXT@
-OPTIONAL_IPMIMONITORING_CFLAGS = @OPTIONAL_IPMIMONITORING_CFLAGS@
-OPTIONAL_IPMIMONITORING_LIBS = @OPTIONAL_IPMIMONITORING_LIBS@
-OPTIONAL_LIBCAP_CFLAGS = @OPTIONAL_LIBCAP_CFLAGS@
-OPTIONAL_LIBCAP_LIBS = @OPTIONAL_LIBCAP_LIBS@
-OPTIONAL_MATH_CLFAGS = @OPTIONAL_MATH_CLFAGS@
-OPTIONAL_MATH_LIBS = @OPTIONAL_MATH_LIBS@
-OPTIONAL_NFACCT_CLFAGS = @OPTIONAL_NFACCT_CLFAGS@
-OPTIONAL_NFACCT_LIBS = @OPTIONAL_NFACCT_LIBS@
-OPTIONAL_UUID_CLFAGS = @OPTIONAL_UUID_CLFAGS@
-OPTIONAL_UUID_LIBS = @OPTIONAL_UUID_LIBS@
-OPTIONAL_ZLIB_CLFAGS = @OPTIONAL_ZLIB_CLFAGS@
-OPTIONAL_ZLIB_LIBS = @OPTIONAL_ZLIB_LIBS@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_RPM_RELEASE = @PACKAGE_RPM_RELEASE@
-PACKAGE_RPM_VERSION = @PACKAGE_RPM_VERSION@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
-PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
-PTHREAD_CC = @PTHREAD_CC@
-PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
-PTHREAD_LIBS = @PTHREAD_LIBS@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SSE_CANDIDATE = @SSE_CANDIDATE@
-STRIP = @STRIP@
-UUID_CFLAGS = @UUID_CFLAGS@
-UUID_LIBS = @UUID_LIBS@
-VERSION = @VERSION@
-ZLIB_CFLAGS = @ZLIB_CFLAGS@
-ZLIB_LIBS = @ZLIB_LIBS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-ax_pthread_config = @ax_pthread_config@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_target = @build_target@
-build_vendor = @build_vendor@
-builddir = @builddir@
-cachedir = @cachedir@
-chartsdir = @chartsdir@
-configdir = @configdir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-has_jemalloc = @has_jemalloc@
-has_tcmalloc = @has_tcmalloc@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libconfigdir = @libconfigdir@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-logdir = @logdir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-nodedir = @nodedir@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-pluginsdir = @pluginsdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-pythondir = @pythondir@
-registrydir = @registrydir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-varlibdir = @varlibdir@
-webdir = @webdir@
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
-CLEANFILES = \
- charts.d.plugin \
- $(NULL)
-
-SUFFIXES = .in
-dist_libconfig_DATA = \
- charts.d.conf \
- $(NULL)
-
-dist_plugins_SCRIPTS = \
- charts.d.dryrun-helper.sh \
- charts.d.plugin \
- loopsleepms.sh.inc \
- $(NULL)
-
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-
-# do not install these files, but include them in the distribution
-dist_noinst_DATA = charts.d.plugin.in README.md $(NULL) ap/README.md \
- ap/Makefile.inc apache/README.md apache/Makefile.inc \
- apcupsd/README.md apcupsd/Makefile.inc cpu_apps/README.md \
- cpu_apps/Makefile.inc cpufreq/README.md cpufreq/Makefile.inc \
- example/README.md example/Makefile.inc exim/README.md \
- exim/Makefile.inc hddtemp/README.md hddtemp/Makefile.inc \
- libreswan/README.md libreswan/Makefile.inc \
- load_average/README.md load_average/Makefile.inc \
- mem_apps/README.md mem_apps/Makefile.inc mysql/README.md \
- mysql/Makefile.inc nginx/README.md nginx/Makefile.inc \
- nut/README.md nut/Makefile.inc opensips/README.md \
- opensips/Makefile.inc phpfpm/README.md phpfpm/Makefile.inc \
- postfix/README.md postfix/Makefile.inc sensors/README.md \
- sensors/Makefile.inc squid/README.md squid/Makefile.inc \
- tomcat/README.md tomcat/Makefile.inc
-dist_charts_SCRIPTS = \
- $(NULL)
-
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-
-# install these files
-dist_charts_DATA = $(NULL) ap/ap.chart.sh apache/apache.chart.sh \
- apcupsd/apcupsd.chart.sh cpu_apps/cpu_apps.chart.sh \
- cpufreq/cpufreq.chart.sh example/example.chart.sh \
- exim/exim.chart.sh hddtemp/hddtemp.chart.sh \
- libreswan/libreswan.chart.sh \
- load_average/load_average.chart.sh mem_apps/mem_apps.chart.sh \
- mysql/mysql.chart.sh nginx/nginx.chart.sh nut/nut.chart.sh \
- opensips/opensips.chart.sh phpfpm/phpfpm.chart.sh \
- postfix/postfix.chart.sh sensors/sensors.chart.sh \
- squid/squid.chart.sh tomcat/tomcat.chart.sh
-userchartsconfigdir = $(configdir)/charts.d
-dist_userchartsconfig_DATA = \
- $(top_srcdir)/installer/.keep \
- $(NULL)
-
-chartsconfigdir = $(libconfigdir)/charts.d
-dist_chartsconfig_DATA = $(top_srcdir)/installer/.keep $(NULL) \
- ap/ap.conf apache/apache.conf apcupsd/apcupsd.conf \
- cpu_apps/cpu_apps.conf cpufreq/cpufreq.conf \
- example/example.conf exim/exim.conf hddtemp/hddtemp.conf \
- libreswan/libreswan.conf load_average/load_average.conf \
- mem_apps/mem_apps.conf mysql/mysql.conf nginx/nginx.conf \
- nut/nut.conf opensips/opensips.conf phpfpm/phpfpm.conf \
- postfix/postfix.conf sensors/sensors.conf squid/squid.conf \
- tomcat/tomcat.conf
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .in
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/build/subst.inc $(srcdir)/ap/Makefile.inc $(srcdir)/apache/Makefile.inc $(srcdir)/apcupsd/Makefile.inc $(srcdir)/cpu_apps/Makefile.inc $(srcdir)/cpufreq/Makefile.inc $(srcdir)/example/Makefile.inc $(srcdir)/exim/Makefile.inc $(srcdir)/hddtemp/Makefile.inc $(srcdir)/libreswan/Makefile.inc $(srcdir)/load_average/Makefile.inc $(srcdir)/mem_apps/Makefile.inc $(srcdir)/mysql/Makefile.inc $(srcdir)/nginx/Makefile.inc $(srcdir)/nut/Makefile.inc $(srcdir)/opensips/Makefile.inc $(srcdir)/phpfpm/Makefile.inc $(srcdir)/postfix/Makefile.inc $(srcdir)/sensors/Makefile.inc $(srcdir)/squid/Makefile.inc $(srcdir)/tomcat/Makefile.inc $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu collectors/charts.d.plugin/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu collectors/charts.d.plugin/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-$(top_srcdir)/build/subst.inc $(srcdir)/ap/Makefile.inc $(srcdir)/apache/Makefile.inc $(srcdir)/apcupsd/Makefile.inc $(srcdir)/cpu_apps/Makefile.inc $(srcdir)/cpufreq/Makefile.inc $(srcdir)/example/Makefile.inc $(srcdir)/exim/Makefile.inc $(srcdir)/hddtemp/Makefile.inc $(srcdir)/libreswan/Makefile.inc $(srcdir)/load_average/Makefile.inc $(srcdir)/mem_apps/Makefile.inc $(srcdir)/mysql/Makefile.inc $(srcdir)/nginx/Makefile.inc $(srcdir)/nut/Makefile.inc $(srcdir)/opensips/Makefile.inc $(srcdir)/phpfpm/Makefile.inc $(srcdir)/postfix/Makefile.inc $(srcdir)/sensors/Makefile.inc $(srcdir)/squid/Makefile.inc $(srcdir)/tomcat/Makefile.inc:
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-install-dist_chartsSCRIPTS: $(dist_charts_SCRIPTS)
- @$(NORMAL_INSTALL)
- @list='$(dist_charts_SCRIPTS)'; test -n "$(chartsdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(chartsdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(chartsdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n' \
- -e 'h;s|.*|.|' \
- -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) { files[d] = files[d] " " $$1; \
- if (++n[d] == $(am__install_max)) { \
- print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
- else { print "f", d "/" $$4, $$1 } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(chartsdir)$$dir'"; \
- $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(chartsdir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-dist_chartsSCRIPTS:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_charts_SCRIPTS)'; test -n "$(chartsdir)" || exit 0; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 's,.*/,,;$(transform)'`; \
- dir='$(DESTDIR)$(chartsdir)'; $(am__uninstall_files_from_dir)
-install-dist_pluginsSCRIPTS: $(dist_plugins_SCRIPTS)
- @$(NORMAL_INSTALL)
- @list='$(dist_plugins_SCRIPTS)'; test -n "$(pluginsdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(pluginsdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(pluginsdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
- done | \
- sed -e 'p;s,.*/,,;n' \
- -e 'h;s|.*|.|' \
- -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
- { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
- if ($$2 == $$4) { files[d] = files[d] " " $$1; \
- if (++n[d] == $(am__install_max)) { \
- print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
- else { print "f", d "/" $$4, $$1 } } \
- END { for (d in files) print "f", d, files[d] }' | \
- while read type dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(pluginsdir)$$dir'"; \
- $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(pluginsdir)$$dir" || exit $$?; \
- } \
- ; done
-
-uninstall-dist_pluginsSCRIPTS:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_plugins_SCRIPTS)'; test -n "$(pluginsdir)" || exit 0; \
- files=`for p in $$list; do echo "$$p"; done | \
- sed -e 's,.*/,,;$(transform)'`; \
- dir='$(DESTDIR)$(pluginsdir)'; $(am__uninstall_files_from_dir)
-install-dist_chartsDATA: $(dist_charts_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dist_charts_DATA)'; test -n "$(chartsdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(chartsdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(chartsdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(chartsdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(chartsdir)" || exit $$?; \
- done
-
-uninstall-dist_chartsDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_charts_DATA)'; test -n "$(chartsdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(chartsdir)'; $(am__uninstall_files_from_dir)
-install-dist_chartsconfigDATA: $(dist_chartsconfig_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dist_chartsconfig_DATA)'; test -n "$(chartsconfigdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(chartsconfigdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(chartsconfigdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(chartsconfigdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(chartsconfigdir)" || exit $$?; \
- done
-
-uninstall-dist_chartsconfigDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_chartsconfig_DATA)'; test -n "$(chartsconfigdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(chartsconfigdir)'; $(am__uninstall_files_from_dir)
-install-dist_libconfigDATA: $(dist_libconfig_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dist_libconfig_DATA)'; test -n "$(libconfigdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(libconfigdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(libconfigdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(libconfigdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(libconfigdir)" || exit $$?; \
- done
-
-uninstall-dist_libconfigDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_libconfig_DATA)'; test -n "$(libconfigdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(libconfigdir)'; $(am__uninstall_files_from_dir)
-install-dist_userchartsconfigDATA: $(dist_userchartsconfig_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dist_userchartsconfig_DATA)'; test -n "$(userchartsconfigdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(userchartsconfigdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(userchartsconfigdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(userchartsconfigdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(userchartsconfigdir)" || exit $$?; \
- done
-
-uninstall-dist_userchartsconfigDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_userchartsconfig_DATA)'; test -n "$(userchartsconfigdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(userchartsconfigdir)'; $(am__uninstall_files_from_dir)
-tags TAGS:
-
-ctags CTAGS:
-
-cscope cscopelist:
-
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(SCRIPTS) $(DATA)
-installdirs:
- for dir in "$(DESTDIR)$(chartsdir)" "$(DESTDIR)$(pluginsdir)" "$(DESTDIR)$(chartsdir)" "$(DESTDIR)$(chartsconfigdir)" "$(DESTDIR)$(libconfigdir)" "$(DESTDIR)$(userchartsconfigdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-dist_chartsDATA install-dist_chartsSCRIPTS \
- install-dist_chartsconfigDATA install-dist_libconfigDATA \
- install-dist_pluginsSCRIPTS install-dist_userchartsconfigDATA
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS \
- uninstall-dist_chartsconfigDATA uninstall-dist_libconfigDATA \
- uninstall-dist_pluginsSCRIPTS \
- uninstall-dist_userchartsconfigDATA
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am check check-am clean clean-generic cscopelist-am \
- ctags-am distclean distclean-generic distdir dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dist_chartsDATA \
- install-dist_chartsSCRIPTS install-dist_chartsconfigDATA \
- install-dist_libconfigDATA install-dist_pluginsSCRIPTS \
- install-dist_userchartsconfigDATA install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
- installcheck installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am tags-am uninstall uninstall-am \
- uninstall-dist_chartsDATA uninstall-dist_chartsSCRIPTS \
- uninstall-dist_chartsconfigDATA uninstall-dist_libconfigDATA \
- uninstall-dist_pluginsSCRIPTS \
- uninstall-dist_userchartsconfigDATA
-
-.in:
- if sed \
- -e 's#[@]localstatedir_POST@#$(localstatedir)#g' \
- -e 's#[@]sbindir_POST@#$(sbindir)#g' \
- -e 's#[@]sysconfdir_POST@#$(sysconfdir)#g' \
- -e 's#[@]pythondir_POST@#$(pythondir)#g' \
- -e 's#[@]configdir_POST@#$(configdir)#g' \
- -e 's#[@]libconfigdir_POST@#$(libconfigdir)#g' \
- -e 's#[@]cachedir_POST@#$(cachedir)#g' \
- $< > $@.tmp; then \
- mv "$@.tmp" "$@"; \
- else \
- rm -f "$@.tmp"; \
- false; \
- fi
-
-# 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.
-.NOEXPORT:
diff --git a/collectors/charts.d.plugin/README.md b/collectors/charts.d.plugin/README.md
index b224bffe..3d318f26 100644
--- a/collectors/charts.d.plugin/README.md
+++ b/collectors/charts.d.plugin/README.md
@@ -191,3 +191,5 @@ This is what you need to do:
Execute the above in this order, since netdata will (by default) attempt to start new plugins soon after they are
created in `/usr/libexec/netdata/plugins.d/`.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/ap/README.md b/collectors/charts.d.plugin/ap/README.md
index eb4e8070..962a8565 100644
--- a/collectors/charts.d.plugin/ap/README.md
+++ b/collectors/charts.d.plugin/ap/README.md
@@ -82,3 +82,5 @@ To edit this file on your system run `/etc/netdata/edit-config charts.d/ap.conf`
## Auto-detection
The plugin is able to auto-detect if you are running access points on your linux box.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fap%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/ap/ap.chart.sh b/collectors/charts.d.plugin/ap/ap.chart.sh
index ccc36120..a2d04c0a 100644
--- a/collectors/charts.d.plugin/ap/ap.chart.sh
+++ b/collectors/charts.d.plugin/ap/ap.chart.sh
@@ -56,8 +56,7 @@ ap_check() {
ap_create() {
local ssid dev
- for dev in "${!ap_devs[@]}"
- do
+ for dev in "${!ap_devs[@]}"; do
ssid="${ap_devs[${dev}]}"
# create the chart with 3 dimensions
@@ -99,14 +98,13 @@ ap_update() {
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
- for dev in "${!ap_devs[@]}"
- do
- echo
- echo "DEVICE ${dev}"
+ for dev in "${!ap_devs[@]}"; do
+ echo
+ echo "DEVICE ${dev}"
iw "${dev}" station dump
- done | awk "
+ done | awk '
function zero_data() {
- dev = \"\";
+ dev = "";
c = 0;
rb = 0;
tb = 0;
@@ -121,32 +119,32 @@ ap_update() {
e = 0;
}
function print_device() {
- if(dev != \"\" && length(dev) > 0) {
- print \"BEGIN ap_clients.\" dev;
- print \"SET clients = \" c;
- print \"END\";
- print \"BEGIN ap_bandwidth.\" dev;
- print \"SET received = \" rb;
- print \"SET sent = \" tb;
- print \"END\";
- print \"BEGIN ap_packets.\" dev;
- print \"SET received = \" rp;
- print \"SET sent = \" tp;
- print \"END\";
- print \"BEGIN ap_issues.\" dev;
- print \"SET retries = \" tr;
- print \"SET failures = \" tf;
- print \"END\";
+ if(dev != "" && length(dev) > 0) {
+ print "BEGIN ap_clients." dev;
+ print "SET clients = " c;
+ print "END";
+ print "BEGIN ap_bandwidth." dev;
+ print "SET received = " rb;
+ print "SET sent = " tb;
+ print "END";
+ print "BEGIN ap_packets." dev;
+ print "SET received = " rp;
+ print "SET sent = " tp;
+ print "END";
+ print "BEGIN ap_issues." dev;
+ print "SET retries = " tr;
+ print "SET failures = " tf;
+ print "END";
if( c == 0 ) c = 1;
- print \"BEGIN ap_signal.\" dev;
- print \"SET signal = \" int(s / c);
- print \"END\";
- print \"BEGIN ap_bitrate.\" dev;
- print \"SET receive = \" int(rt / c);
- print \"SET transmit = \" int(tt / c);
- print \"SET expected = \" int(e / c);
- print \"END\";
+ print "BEGIN ap_signal." dev;
+ print "SET signal = " int(s / c);
+ print "END";
+ print "BEGIN ap_bitrate." dev;
+ print "SET receive = " int(rt / c);
+ print "SET transmit = " int(tt / c);
+ print "SET expected = " int(e / c);
+ print "END";
}
zero_data();
}
@@ -155,28 +153,27 @@ ap_update() {
}
/^DEVICE / {
print_device();
- dev = \$2;
+ dev = $2;
}
/^Station/ { c++; }
- /^[ \\t]+rx bytes:/ { rb += \$3; }
- /^[ \\t]+tx bytes:/ { tb += \$3; }
- /^[ \\t]+rx packets:/ { rp += \$3; }
- /^[ \\t]+tx packets:/ { tp += \$3; }
- /^[ \\t]+tx retries:/ { tr += \$3; }
- /^[ \\t]+tx failed:/ { tf += \$3; }
- /^[ \\t]+signal:/ { x = \$2; s += x * 1000; }
- /^[ \\t]+rx bitrate:/ { x = \$3; rt += x * 1000; }
- /^[ \\t]+tx bitrate:/ { x = \$3; tt += x * 1000; }
- /^[ \\t]+expected throughput:(.*)Mbps/ {
- x=\$3;
- sub(/Mbps/, \"\", x);
+ /^[ \t]+rx bytes:/ { rb += $3; }
+ /^[ \t]+tx bytes:/ { tb += $3; }
+ /^[ \t]+rx packets:/ { rp += $3; }
+ /^[ \t]+tx packets:/ { tp += $3; }
+ /^[ \t]+tx retries:/ { tr += $3; }
+ /^[ \t]+tx failed:/ { tf += $3; }
+ /^[ \t]+signal:/ { x = $2; s += x * 1000; }
+ /^[ \t]+rx bitrate:/ { x = $3; rt += x * 1000; }
+ /^[ \t]+tx bitrate:/ { x = $3; tt += x * 1000; }
+ /^[ \t]+expected throughput:(.*)Mbps/ {
+ x=$3;
+ sub(/Mbps/, "", x);
e += x * 1000;
}
END {
print_device();
}
- "
+ '
return 0
}
-
diff --git a/collectors/charts.d.plugin/apache/README.md b/collectors/charts.d.plugin/apache/README.md
index 890cee98..27397910 100644
--- a/collectors/charts.d.plugin/apache/README.md
+++ b/collectors/charts.d.plugin/apache/README.md
@@ -1,10 +1,10 @@
+# Apache
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/apache) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
---
-# Apache Plugin (apache)
-
The `apache` collector visualizes key performance data for an apache web server.
## Example netdata charts
@@ -125,3 +125,5 @@ curl "http://127.0.0.1:80/server-status?auto"
netdata will be able to do it too.
Notice: You may need to have the default `000-default.conf ` website enabled in order for the status mod to work.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fapache%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/apache/apache.chart.sh b/collectors/charts.d.plugin/apache/apache.chart.sh
index 95876432..7d09ee67 100644
--- a/collectors/charts.d.plugin/apache/apache.chart.sh
+++ b/collectors/charts.d.plugin/apache/apache.chart.sh
@@ -52,21 +52,20 @@ apache_key_connsasynckeepalive=
apache_key_connsasyncclosing=
apache_detect() {
local i=0
- for x in "${@}"
- do
+ for x in "${@}"; do
case "${x}" in
- 'Total Accesses') apache_key_accesses=$((i + 1)) ;;
- 'Total kBytes') apache_key_kbytes=$((i + 1)) ;;
- 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;;
- 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;;
- 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;;
- 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;;
- 'IdleWorkers') apache_key_idleworkers=$((i + 1));;
- 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;;
- 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;;
- 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;;
- 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;;
- 'Scoreboard') apache_key_scoreboard=$((i)) ;;
+ 'Total Accesses') apache_key_accesses=$((i + 1)) ;;
+ 'Total kBytes') apache_key_kbytes=$((i + 1)) ;;
+ 'ReqPerSec') apache_key_reqpersec=$((i + 1)) ;;
+ 'BytesPerSec') apache_key_bytespersec=$((i + 1)) ;;
+ 'BytesPerReq') apache_key_bytesperreq=$((i + 1)) ;;
+ 'BusyWorkers') apache_key_busyworkers=$((i + 1)) ;;
+ 'IdleWorkers') apache_key_idleworkers=$((i + 1)) ;;
+ 'ConnsTotal') apache_key_connstotal=$((i + 1)) ;;
+ 'ConnsAsyncWriting') apache_key_connsasyncwriting=$((i + 1)) ;;
+ 'ConnsAsyncKeepAlive') apache_key_connsasynckeepalive=$((i + 1)) ;;
+ 'ConnsAsyncClosing') apache_key_connsasyncclosing=$((i + 1)) ;;
+ 'Scoreboard') apache_key_scoreboard=$((i)) ;;
esac
i=$((i + 1))
@@ -74,20 +73,19 @@ apache_detect() {
# we will not check of the Conns*
# keys, since these are apache 2.4 specific
- [ -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_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
+ [ -z "${apache_key_scoreboard}" ] && error "missing 'Scoreboard' from apache server: ${*}" && return 1
- if [ ! -z "${apache_key_connstotal}" ] && \
- [ ! -z "${apache_key_connsasyncwriting}" ] && \
- [ ! -z "${apache_key_connsasynckeepalive}" ] && \
- [ ! -z "${apache_key_connsasyncclosing}" ]
- then
+ if [ ! -z "${apache_key_connstotal}" ] &&
+ [ ! -z "${apache_key_connsasyncwriting}" ] &&
+ [ ! -z "${apache_key_connsasynckeepalive}" ] &&
+ [ ! -z "${apache_key_connsasyncclosing}" ]; then
apache_has_conns=1
else
apache_has_conns=0
@@ -103,15 +101,13 @@ apache_get() {
ret=$?
IFS="${oIFS}"
- if [ $ret -ne 0 ] || [ "${#apache_response[@]}" -eq 0 ]
- then
+ if [ $ret -ne 0 ] || [ "${#apache_response[@]}" -eq 0 ]; then
return 1
fi
# the last line on the apache output is "Scoreboard"
# we use this label to detect that the output has a new word count
- if [ ${apache_keys_detected} -eq 0 ] || [ "${apache_response[${apache_key_scoreboard}]}" != "Scoreboard" ]
- then
+ if [ ${apache_keys_detected} -eq 0 ] || [ "${apache_response[${apache_key_scoreboard}]}" != "Scoreboard" ]; then
apache_detect "${apache_response[@]}" || return 1
apache_keys_detected=1
fi
@@ -131,20 +127,20 @@ apache_get() {
apache_busyworkers="${apache_response[${apache_key_busyworkers}]}"
apache_idleworkers="${apache_response[${apache_key_idleworkers}]}"
- if [ -z "${apache_accesses}" ] || \
- [ -z "${apache_kbytes}" ] || \
- [ -z "${apache_reqpersec}" ] || \
- [ -z "${apache_bytespersec}" ] || \
- [ -z "${apache_bytesperreq}" ] || \
- [ -z "${apache_busyworkers}" ]
- [ -z "${apache_idleworkers}" ]
+ if
+ [ -z "${apache_accesses}" ] ||
+ [ -z "${apache_kbytes}" ] ||
+ [ -z "${apache_reqpersec}" ] ||
+ [ -z "${apache_bytespersec}" ] ||
+ [ -z "${apache_bytesperreq}" ] ||
+ [ -z "${apache_busyworkers}" ]
+ [ -z "${apache_idleworkers}" ]
then
error "empty values got from apache server: ${apache_response[*]}"
return 1
fi
- if [ ${apache_has_conns} -eq 1 ]
- then
+ if [ ${apache_has_conns} -eq 1 ]; then
apache_connstotal="${apache_response[${apache_key_connstotal}]}"
apache_connsasyncwriting="${apache_response[${apache_key_connsasyncwriting}]}"
apache_connsasynckeepalive="${apache_response[${apache_key_connsasynckeepalive}]}"
@@ -159,8 +155,7 @@ apache_check() {
apache_get
# shellcheck disable=2181
- if [ $? -ne 0 ]
- then
+ if [ $? -ne 0 ]; then
# shellcheck disable=2154
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
@@ -191,8 +186,7 @@ CHART apache_local.net '' "apache Bandwidth" "kilobits/s" bandwidth apache.net a
DIMENSION sent '' incremental 8 1
EOF
- if [ ${apache_has_conns} -eq 1 ]
- then
+ if [ ${apache_has_conns} -eq 1 ]; then
cat <<EOF2
CHART apache_local.connections '' "apache Connections" "connections" connections apache.connections line $((apache_priority + 2)) $apache_update_every
DIMENSION connections '' absolute 1 1
@@ -240,9 +234,8 @@ SET busy = $((apache_busyworkers))
END
VALUESEOF
- if [ ${apache_has_conns} -eq 1 ]
- then
- cat <<VALUESEOF2
+ if [ ${apache_has_conns} -eq 1 ]; then
+ cat <<VALUESEOF2
BEGIN apache_local.connections $1
SET connections = $((apache_connstotal))
END
diff --git a/collectors/charts.d.plugin/apcupsd/README.md b/collectors/charts.d.plugin/apcupsd/README.md
index e69de29b..59739efc 100644
--- a/collectors/charts.d.plugin/apcupsd/README.md
+++ b/collectors/charts.d.plugin/apcupsd/README.md
@@ -0,0 +1,7 @@
+# apcupsd
+
+*Under construction*
+
+Collects UPS metrics
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fapcupsd%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
index e26ef566..b4b92cdc 100644
--- a/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
+++ b/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
@@ -11,7 +11,7 @@ apcupsd_ip=
apcupsd_port=
declare -A apcupsd_sources=(
- ["local"]="127.0.0.1:3551"
+ ["local"]="127.0.0.1:3551"
)
# how frequently to collect UPS data
@@ -35,46 +35,40 @@ apcupsd_check() {
require_cmd apcaccess || return 1
# backwards compatibility
- if [ "${apcupsd_ip}:${apcupsd_port}" != ":" ]
- then
- apcupsd_sources["local"]="${apcupsd_ip}:${apcupsd_port}"
+ if [ "${apcupsd_ip}:${apcupsd_port}" != ":" ]; then
+ apcupsd_sources["local"]="${apcupsd_ip}:${apcupsd_port}"
fi
- local host working=0 failed=0
- for host in "${!apcupsd_sources[@]}"
- do
- run apcupsd_get "${apcupsd_sources[${host}]}" >/dev/null
- # shellcheck disable=2181
- if [ $? -ne 0 ]
- then
- error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
- failed=$((failed + 1))
- elif [ "$(apcupsd_get "${apcupsd_sources[${host}]}" | awk '/^STATUS.*/{ print $3 }')" != "ONLINE" ]
- then
- error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
- failed=$((failed + 1))
- else
- working=$((working + 1))
- fi
- done
-
- if [ ${working} -eq 0 ]
- then
- error "No APC UPSes found available."
- return 1
- fi
+ local host working=0 failed=0
+ for host in "${!apcupsd_sources[@]}"; do
+ run apcupsd_get "${apcupsd_sources[${host}]}" >/dev/null
+ # shellcheck disable=2181
+ if [ $? -ne 0 ]; then
+ error "cannot get information for apcupsd server ${host} on ${apcupsd_sources[${host}]}."
+ failed=$((failed + 1))
+ elif [ "$(apcupsd_get "${apcupsd_sources[${host}]}" | awk '/^STATUS.*/{ print $3 }')" != "ONLINE" ]; then
+ error "APC UPS ${host} on ${apcupsd_sources[${host}]} is not online."
+ failed=$((failed + 1))
+ else
+ working=$((working + 1))
+ fi
+ done
+
+ if [ ${working} -eq 0 ]; then
+ error "No APC UPSes found available."
+ return 1
+ fi
return 0
}
apcupsd_create() {
- local host src
- for host in "${!apcupsd_sources[@]}"
- do
- src=${apcupsd_sources[${host}]}
+ local host src
+ for host in "${!apcupsd_sources[@]}"; do
+ src=${apcupsd_sources[${host}]}
- # create the charts
- cat <<EOF
+ # create the charts
+ cat <<EOF
CHART apcupsd_${host}.charge '' "UPS Charge for ${host} on ${src}" "percentage" ups apcupsd.charge area $((apcupsd_priority + 1)) $apcupsd_update_every
DIMENSION battery_charge charge absolute 1 100
@@ -103,12 +97,14 @@ DIMENSION temp temp absolute 1 100
CHART apcupsd_${host}.time '' "UPS Time Remaining for ${host} on ${src}" "Minutes" ups apcupsd.time area $((apcupsd_priority + 2)) $apcupsd_update_every
DIMENSION time time absolute 1 100
+CHART apcupsd_${host}.online '' "UPS ONLINE flag for ${host} on ${src}" "boolean" ups apcupsd.online line $((apcupsd_priority + 8)) $apcupsd_update_every
+DIMENSION online online absolute 0 1
+
EOF
- done
+ done
return 0
}
-
apcupsd_update() {
# the first argument to this function is the microseconds since last update
# pass this parameter to the BEGIN statement (see bellow).
@@ -117,10 +113,9 @@ apcupsd_update() {
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
- local host working=0 failed=0
- for host in "${!apcupsd_sources[@]}"
- do
- apcupsd_get "${apcupsd_sources[${host}]}" | awk "
+ local host working=0 failed=0
+ for host in "${!apcupsd_sources[@]}"; do
+ apcupsd_get "${apcupsd_sources[${host}]}" | awk "
BEGIN {
battery_charge = 0;
@@ -130,70 +125,76 @@ BEGIN {
input_voltage_min = 0;
input_voltage_max = 0;
input_frequency = 0;
- output_voltage = 0;
+ output_voltage = 0;
output_voltage_nominal = 0;
load = 0;
temp = 0;
time = 0;
}
-/^BCHARGE.*/ { battery_charge = \$3 * 100 };
-/^BATTV.*/ { battery_voltage = \$3 * 100 };
-/^NOMBATTV.*/ { battery_voltage_nominal = \$3 * 100 };
-/^LINEV.*/ { input_voltage = \$3 * 100 };
-/^MINLINEV.*/ { input_voltage_min = \$3 * 100 };
-/^MAXLINEV.*/ { input_voltage_max = \$3 * 100 };
-/^LINEFREQ.*/ { input_frequency = \$3 * 100 };
-/^OUTPUTV.*/ { output_voltage = \$3 * 100 };
-/^NOMOUTV.*/ { output_voltage_nominal = \$3 * 100 };
-/^LOADPCT.*/ { load = \$3 * 100 };
-/^ITEMP.*/ { temp = \$3 * 100 };
-/^TIMELEFT.*/ { time = \$3 * 100 };
+/^BCHARGE.*/ { battery_charge = \$3 * 100 };
+/^BATTV.*/ { battery_voltage = \$3 * 100 };
+/^NOMBATTV.*/ { battery_voltage_nominal = \$3 * 100 };
+/^LINEV.*/ { input_voltage = \$3 * 100 };
+/^MINLINEV.*/ { input_voltage_min = \$3 * 100 };
+/^MAXLINEV.*/ { input_voltage_max = \$3 * 100 };
+/^LINEFREQ.*/ { input_frequency = \$3 * 100 };
+/^OUTPUTV.*/ { output_voltage = \$3 * 100 };
+/^NOMOUTV.*/ { output_voltage_nominal = \$3 * 100 };
+/^LOADPCT.*/ { load = \$3 * 100 };
+/^ITEMP.*/ { temp = \$3 * 100 };
+/^TIMELEFT.*/ { time = \$3 * 100 };
+/^STATUS.*/ { online=(\$3 == \"ONLINE\")?1:0 };
END {
- print \"BEGIN apcupsd_${host}.charge $1\";
- print \"SET battery_charge = \" battery_charge;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.battery_voltage $1\";
- print \"SET battery_voltage = \" battery_voltage;
- print \"SET battery_voltage_nominal = \" battery_voltage_nominal;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.input_voltage $1\";
- print \"SET input_voltage = \" input_voltage;
- print \"SET input_voltage_min = \" input_voltage_min;
- print \"SET input_voltage_max = \" input_voltage_max;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.input_frequency $1\";
- print \"SET input_frequency = \" input_frequency;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.output_voltage $1\";
- print \"SET output_voltage = \" output_voltage;
- print \"SET output_voltage_nominal = \" output_voltage_nominal;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.load $1\";
- print \"SET load = \" load;
- print \"END\"
-
- print \"BEGIN apcupsd_${host}.temp $1\";
- print \"SET temp = \" temp;
+ print \"BEGIN apcupsd_${host}.online $1\";
+ print \"SET online = \" online;
print \"END\"
- print \"BEGIN apcupsd_${host}.time $1\";
- print \"SET time = \" time;
- print \"END\"
+ if (online == 1) {
+ print \"BEGIN apcupsd_${host}.charge $1\";
+ print \"SET battery_charge = \" battery_charge;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.battery_voltage $1\";
+ print \"SET battery_voltage = \" battery_voltage;
+ print \"SET battery_voltage_nominal = \" battery_voltage_nominal;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.input_voltage $1\";
+ print \"SET input_voltage = \" input_voltage;
+ print \"SET input_voltage_min = \" input_voltage_min;
+ print \"SET input_voltage_max = \" input_voltage_max;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.input_frequency $1\";
+ print \"SET input_frequency = \" input_frequency;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.output_voltage $1\";
+ print \"SET output_voltage = \" output_voltage;
+ print \"SET output_voltage_nominal = \" output_voltage_nominal;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.load $1\";
+ print \"SET load = \" load;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.temp $1\";
+ print \"SET temp = \" temp;
+ print \"END\"
+
+ print \"BEGIN apcupsd_${host}.time $1\";
+ print \"SET time = \" time;
+ print \"END\"
+ }
}"
- # shellcheck disable=SC2181
- if [ $? -ne 0 ]
- then
- failed=$((failed + 1))
- error "failed to get values for APC UPS ${host} on ${apcupsd_sources[${host}]}" && return 1
- else
- working=$((working + 1))
- fi
- done
+ # shellcheck disable=SC2181
+ if [ $? -ne 0 ]; then
+ failed=$((failed + 1))
+ error "failed to get values for APC UPS ${host} on ${apcupsd_sources[${host}]}" && return 1
+ else
+ working=$((working + 1))
+ fi
+ done
[ $working -eq 0 ] && error "failed to get values from all APC UPSes" && return 1
diff --git a/collectors/charts.d.plugin/charts.d.dryrun-helper.sh b/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
index 67496c1b..91af2c54 100755
--- a/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
+++ b/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
@@ -17,7 +17,7 @@ tmp1="$(mktemp)"
tmp2="$(mktemp)"
myset() {
- set | grep -v "^_=" | grep -v "^PIPESTATUS=" | grep -v "^BASH_LINENO="
+ set | grep -v "^_=" | grep -v "^PIPESTATUS=" | grep -v "^BASH_LINENO="
}
# save 2 'set'
@@ -26,52 +26,46 @@ myset >"$tmp2"
# make sure they don't differ
diff "$tmp1" "$tmp2" >/dev/null 2>&1
-if [ $? -ne 0 ]
-then
- # they differ, we cannot do the check
- echo >&2 "$me: cannot check with diff."
- can_diff=0
+if [ $? -ne 0 ]; then
+ # they differ, we cannot do the check
+ echo >&2 "$me: cannot check with diff."
+ can_diff=0
fi
# do it again, now including the script
myset >"$tmp1"
# include the plugin and its config
-if [ -f "$conf" ]
-then
- # shellcheck source=/dev/null
- . "$conf"
- if [ $? -ne 0 ]
- then
- echo >&2 "$me: cannot load config file $conf"
- rm "$tmp1" "$tmp2"
- exit 1
- fi
+if [ -f "$conf" ]; then
+ # shellcheck source=/dev/null
+ . "$conf"
+ if [ $? -ne 0 ]; then
+ echo >&2 "$me: cannot load config file $conf"
+ rm "$tmp1" "$tmp2"
+ exit 1
+ fi
fi
# shellcheck source=/dev/null
. "$chart"
-if [ $? -ne 0 ]
-then
- echo >&2 "$me: cannot load chart file $chart"
- rm "$tmp1" "$tmp2"
- exit 1
+if [ $? -ne 0 ]; then
+ echo >&2 "$me: cannot load chart file $chart"
+ rm "$tmp1" "$tmp2"
+ exit 1
fi
# remove all variables starting with the plugin name
myset | grep -v "^$name" >"$tmp2"
-if [ $can_diff -eq 1 ]
-then
- # check if they are different
- # make sure they don't differ
- diff "$tmp1" "$tmp2" >&2
- if [ $? -ne 0 ]
- then
- # they differ
- rm "$tmp1" "$tmp2"
- exit 1
- fi
+if [ $can_diff -eq 1 ]; then
+ # check if they are different
+ # make sure they don't differ
+ diff "$tmp1" "$tmp2" >&2
+ if [ $? -ne 0 ]; then
+ # they differ
+ rm "$tmp1" "$tmp2"
+ exit 1
+ fi
fi
rm "$tmp1" "$tmp2"
diff --git a/collectors/charts.d.plugin/charts.d.plugin b/collectors/charts.d.plugin/charts.d.plugin
deleted file mode 100644
index 1c6e8c5c..00000000
--- a/collectors/charts.d.plugin/charts.d.plugin
+++ /dev/null
@@ -1,743 +0,0 @@
-#!/usr/bin/env bash
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-# netdata
-# real-time performance and health monitoring, done right!
-# (C) 2017 Costa Tsaousis <costa@tsaousis.gr>
-# GPL v3+
-#
-# charts.d.plugin allows easy development of BASH plugins
-#
-# if you need to run parallel charts.d processes, link this file to a different name
-# in the same directory, with a .plugin suffix and netdata will start both of them,
-# each will have a different config file and modules configuration directory.
-#
-
-export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
-
-PROGRAM_FILE="$0"
-PROGRAM_NAME="$(basename $0)"
-PROGRAM_NAME="${PROGRAM_NAME/.plugin}"
-MODULE_NAME="main"
-
-# -----------------------------------------------------------------------------
-# create temp dir
-
-debug=0
-TMP_DIR=
-chartsd_cleanup() {
- trap '' EXIT QUIT HUP INT TERM
-
- if [ ! -z "$TMP_DIR" -a -d "$TMP_DIR" ]
- then
- [ $debug -eq 1 ] && echo >&2 "$PROGRAM_NAME: cleaning up temporary directory $TMP_DIR ..."
- rm -rf "$TMP_DIR"
- fi
- exit 0
-}
-trap chartsd_cleanup EXIT QUIT HUP INT TERM
-
-if [ $UID = "0" ]
-then
- TMP_DIR="$( mktemp -d /var/run/netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
-else
- TMP_DIR="$( mktemp -d /tmp/.netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
-fi
-
-logdate() {
- date "+%Y-%m-%d %H:%M:%S"
-}
-
-log() {
- local status="${1}"
- shift
-
- echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: ${*}"
-
-}
-
-warning() {
- log WARNING "${@}"
-}
-
-error() {
- log ERROR "${@}"
-}
-
-info() {
- log INFO "${@}"
-}
-
-fatal() {
- log FATAL "${@}"
- echo "DISABLE"
- exit 1
-}
-
-debug() {
- [ $debug -eq 1 ] && log DEBUG "${@}"
-}
-
-# -----------------------------------------------------------------------------
-# check a few commands
-
-require_cmd() {
- local x=$(which "${1}" 2>/dev/null || command -v "${1}" 2>/dev/null)
- if [ -z "${x}" -o ! -x "${x}" ]
- then
- warning "command '${1}' is not found in ${PATH}."
- eval "${1^^}_CMD=\"\""
- return 1
- fi
-
- eval "${1^^}_CMD=\"${x}\""
- return 0
-}
-
-require_cmd date || exit 1
-require_cmd sed || exit 1
-require_cmd basename || exit 1
-require_cmd dirname || exit 1
-require_cmd cat || exit 1
-require_cmd grep || exit 1
-require_cmd egrep || exit 1
-require_cmd mktemp || exit 1
-require_cmd awk || exit 1
-require_cmd timeout || exit 1
-require_cmd curl || exit 1
-
-# -----------------------------------------------------------------------------
-
-[ $(( ${BASH_VERSINFO[0]} )) -lt 4 ] && fatal "BASH version 4 or later is required, but found version: ${BASH_VERSION}. Please upgrade."
-
-info "started from '$PROGRAM_FILE' with options: $*"
-
-# -----------------------------------------------------------------------------
-# internal defaults
-# netdata exposes a few environment variables for us
-
-[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
-[ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="/usr/local/etc/netdata"
-[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="/usr/local/lib/netdata/conf.d"
-
-pluginsd="${NETDATA_PLUGINS_DIR}"
-stockconfd="${NETDATA_STOCK_CONFIG_DIR}/${PROGRAM_NAME}"
-userconfd="${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}"
-olduserconfd="${NETDATA_USER_CONFIG_DIR}"
-chartsd="$pluginsd/../charts.d"
-
-minimum_update_frequency="${NETDATA_UPDATE_EVERY-1}"
-update_every=${minimum_update_frequency} # this will be overwritten by the command line
-
-# work around for non BASH shells
-charts_create="_create"
-charts_update="_update"
-charts_check="_check"
-charts_undescore="_"
-
-# when making iterations, charts.d can loop more frequently
-# to prevent plugins missing iterations.
-# this is a percentage relative to update_every to align its
-# iterations.
-# The minimum is 10%, the maximum 100%.
-# So, if update_every is 1 second and time_divisor is 50,
-# charts.d will iterate every 500ms.
-# Charts will be called to collect data only if the time
-# passed since the last time the collected data is equal or
-# above their update_every.
-time_divisor=50
-
-# number of seconds to run without restart
-# after this time, charts.d.plugin will exit
-# netdata will restart it
-restart_timeout=$((3600 * 4))
-
-# check if the charts.d plugins are using global variables
-# they should not.
-# It does not currently support BASH v4 arrays, so it is
-# disabled
-dryrunner=0
-
-# check for timeout command
-check_for_timeout=1
-
-# the default enable/disable value for all charts
-enable_all_charts="yes"
-
-# -----------------------------------------------------------------------------
-# parse parameters
-
-check=0
-chart_only=
-while [ ! -z "$1" ]
-do
- if [ "$1" = "check" ]
- then
- check=1
- shift
- continue
- fi
-
- if [ "$1" = "debug" -o "$1" = "all" ]
- then
- debug=1
- shift
- continue
- fi
-
- if [ -f "$chartsd/$1.chart.sh" ]
- then
- debug=1
- chart_only="$( echo $1.chart.sh | sed "s/\.chart\.sh$//g" )"
- shift
- continue
- fi
-
- if [ -f "$chartsd/$1" ]
- then
- debug=1
- chart_only="$( echo $1 | sed "s/\.chart\.sh$//g" )"
- shift
- continue
- fi
-
- # number check
- n="$1"
- x=$(( n ))
- if [ "$x" = "$n" ]
- then
- shift
- update_every=$x
- [ $update_every -lt $minimum_update_frequency ] && update_every=$minimum_update_frequency
- continue
- fi
-
- fatal "Cannot understand parameter $1. Aborting."
-done
-
-
-# -----------------------------------------------------------------------------
-# loop control
-
-# default sleep function
-LOOPSLEEPMS_HIGHRES=0
-now_ms=
-current_time_ms_default() {
- now_ms="$(date +'%s')000"
-}
-current_time_ms="current_time_ms_default"
-current_time_ms_accuracy=1
-mysleep="sleep"
-
-# if found and included, this file overwrites loopsleepms()
-# and current_time_ms() with a high resolution timer function
-# for precise looping.
-source "$pluginsd/loopsleepms.sh.inc"
-[ $? -ne 0 ] && error "Failed to load '$pluginsd/loopsleepms.sh.inc'."
-
-# -----------------------------------------------------------------------------
-# load my configuration
-
-for myconfig in "${NETDATA_STOCK_CONFIG_DIR}/${PROGRAM_NAME}.conf" "${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf"
-do
- if [ -f "$myconfig" ]
- then
- source "$myconfig"
- if [ $? -ne 0 ]
- then
- error "Config file '$myconfig' loaded with errors."
- else
- info "Configuration file '$myconfig' loaded."
- fi
- else
- warning "Configuration file '$myconfig' not found."
- fi
-done
-
-# make sure time_divisor is right
-time_divisor=$((time_divisor))
-[ $time_divisor -lt 10 ] && time_divisor=10
-[ $time_divisor -gt 100 ] && time_divisor=100
-
-
-# we check for the timeout command, after we load our
-# configuration, so that the user may overwrite the
-# timeout command we use, providing a function that
-# can emulate the timeout command we need:
-# > timeout SECONDS command ...
-if [ $check_for_timeout -eq 1 ]
- then
- require_cmd timeout || exit 1
-fi
-
-# -----------------------------------------------------------------------------
-# internal checks
-
-# netdata passes the requested update frequency as the first argument
-update_every=$(( update_every + 1 - 1)) # makes sure it is a number
-test $update_every -eq 0 && update_every=1 # if it is zero, make it 1
-
-# check the charts.d directory
-[ ! -d "$chartsd" ] && fatal "cannot find charts directory '$chartsd'"
-
-# -----------------------------------------------------------------------------
-# library functions
-
-fixid() {
- echo "$*" |\
- tr -c "[A-Z][a-z][0-9]" "_" |\
- sed -e "s|^_\+||g" -e "s|_\+$||g" -e "s|_\+|_|g" |\
- tr "[A-Z]" "[a-z]"
-}
-
-run() {
- local ret pid="${BASHPID}" t
-
- if [ "z${1}" = "z-t" -a "${2}" != "0" ]
- then
- t="${2}"
- shift 2
- timeout ${t} "${@}" 2>"${TMP_DIR}/run.${pid}"
- ret=$?
- else
- "${@}" 2>"${TMP_DIR}/run.${pid}"
- ret=$?
- fi
-
- if [ ${ret} -ne 0 ]
- then
- {
- printf "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: command '"
- printf "%q " "${@}"
- printf "' failed with code ${ret}:\n --- BEGIN TRACE ---\n"
- cat "${TMP_DIR}/run.${pid}"
- printf " --- END TRACE ---\n"
- } >&2
- fi
- rm "${TMP_DIR}/run.${pid}"
-
- return ${ret}
-}
-
-# convert any floating point number
-# to integer, give a multiplier
-# the result is stored in ${FLOAT2INT_RESULT}
-# so that no fork is necessary
-# the multiplier must be a power of 10
-float2int() {
- local f m="$2" a b l v=($1)
- f=${v[0]}
-
- # the length of the multiplier - 1
- l=$(( ${#m} - 1 ))
-
- # check if the number is in scientific notation
- if [[ ${f} =~ ^[[:space:]]*(-)?[0-9.]+(e|E)(\+|-)[0-9]+ ]]
- then
- # convert it to decimal
- # unfortunately, this fork cannot be avoided
- # if you know of a way to avoid it, please let me know
- f=$(printf "%0.${l}f" ${f})
- fi
-
- # split the floating point number
- # in integer (a) and decimal (b)
- a=${f/.*/}
- b=${f/*./}
-
- # if the integer part is missing
- # set it to zero
- [ -z "${a}" ] && a="0"
-
- # strip leading zeros from the integer part
- # base 10 convertion
- a=$((10#$a))
-
- # check the length of the decimal part
- # against the length of the multiplier
- if [ ${#b} -gt ${l} ]
- then
- # too many digits - take the most significant
- b=${b:0:${l}}
-
- elif [ ${#b} -lt ${l} ]
- then
- # too few digits - pad with zero on the right
- local z="00000000000000000000000" r=$((l - ${#b}))
- b="${b}${z:0:${r}}"
- fi
-
- # strip leading zeros from the decimal part
- # base 10 convertion
- b=$((10#$b))
-
- # store the result
- FLOAT2INT_RESULT=$(( (a * m) + b ))
-}
-
-
-# -----------------------------------------------------------------------------
-# charts check functions
-
-all_charts() {
- cd "$chartsd"
- [ $? -ne 0 ] && error "cannot cd to $chartsd" && return 1
-
- ls *.chart.sh | sed "s/\.chart\.sh$//g"
-}
-
-declare -A charts_enable_keyword=(
- ['apache']="force"
- ['cpu_apps']="force"
- ['cpufreq']="force"
- ['example']="force"
- ['exim']="force"
- ['hddtemp']="force"
- ['load_average']="force"
- ['mem_apps']="force"
- ['mysql']="force"
- ['nginx']="force"
- ['phpfpm']="force"
- ['postfix']="force"
- ['sensors']="force"
- ['squid']="force"
- ['tomcat']="force"
- )
-
-all_enabled_charts() {
- local charts= enabled= required=
-
- # find all enabled charts
-
- for chart in $( all_charts )
- do
- MODULE_NAME="${chart}"
-
- eval "enabled=\$$chart"
- if [ -z "${enabled}" ]
- then
- enabled="${enable_all_charts}"
- fi
-
- required="${charts_enable_keyword[${chart}]}"
- [ -z "${required}" ] && required="yes"
-
- if [ ! "${enabled}" = "${required}" ]
- then
- info "is disabled. Add a line with $chart=$required in '${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf' to enable it (or remove the line that disables it)."
- else
- debug "is enabled for auto-detection."
- local charts="$charts $chart"
- fi
- done
- MODULE_NAME="main"
-
- local charts2=
- for chart in $charts
- do
- MODULE_NAME="${chart}"
-
- # check the enabled charts
- local check="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_check()" )"
- if [ -z "$check" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_check() function. Disabling it."
- continue
- fi
-
- local create="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_create()" )"
- if [ -z "$create" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_create() function. Disabling it."
- continue
- fi
-
- local update="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_update()" )"
- if [ -z "$update" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_update() function. Disabling it."
- continue
- fi
-
- # check its config
- #if [ -f "$userconfd/$chart.conf" ]
- #then
- # if [ ! -z "$( cat "$userconfd/$chart.conf" | sed "s/^ \+//g" | grep -v "^$" | grep -v "^#" | grep -v "^$chart$charts_undescore" )" ]
- # then
- # error "module's $chart config $userconfd/$chart.conf should only have lines starting with $chart$charts_undescore . Disabling it."
- # continue
- # fi
- #fi
-
- #if [ $dryrunner -eq 1 ]
- # then
- # "$pluginsd/charts.d.dryrun-helper.sh" "$chart" "$chartsd/$chart.chart.sh" "$userconfd/$chart.conf" >/dev/null
- # if [ $? -ne 0 ]
- # then
- # error "module's $chart did not pass the dry run check. This means it uses global variables not starting with $chart. Disabling it."
- # continue
- # fi
- #fi
-
- local charts2="$charts2 $chart"
- done
- MODULE_NAME="main"
-
- echo $charts2
- debug "enabled charts: $charts2"
-}
-
-# -----------------------------------------------------------------------------
-# load the charts
-
-suffix_retries="_retries"
-suffix_update_every="_update_every"
-active_charts=
-for chart in $( all_enabled_charts )
-do
- MODULE_NAME="${chart}"
-
- debug "loading module: '$chartsd/$chart.chart.sh'"
-
- source "$chartsd/$chart.chart.sh"
- [ $? -ne 0 ] && warning "Module '$chartsd/$chart.chart.sh' loaded with errors."
-
- # first load the stock config
- if [ -f "$stockconfd/$chart.conf" ]
- then
- debug "loading module configuration: '$stockconfd/$chart.conf'"
- source "$stockconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$stockconfd/$chart.conf' loaded with errors."
- else
- debug "not found module configuration: '$stockconfd/$chart.conf'"
- fi
-
- # then load the user config (it overwrites the stock)
- if [ -f "$userconfd/$chart.conf" ]
- then
- debug "loading module configuration: '$userconfd/$chart.conf'"
- source "$userconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$userconfd/$chart.conf' loaded with errors."
- else
- debug "not found module configuration: '$userconfd/$chart.conf'"
-
- if [ -f "$olduserconfd/$chart.conf" ]
- then
- # support for very old netdata that had the charts.d module configs in /etc/netdata
- info "loading module configuration from obsolete location: '$olduserconfd/$chart.conf'"
- source "$olduserconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$olduserconfd/$chart.conf' loaded with errors."
- fi
- fi
-
- eval "dt=\$$chart$suffix_update_every"
- dt=$(( dt + 1 - 1 )) # make sure it is a number
- if [ $dt -lt $update_every ]
- then
- eval "$chart$suffix_update_every=$update_every"
- fi
-
- $chart$charts_check
- if [ $? -eq 0 ]
- then
- debug "module '$chart' activated"
- active_charts="$active_charts $chart"
- else
- error "module's '$chart' check() function reports failure."
- fi
-done
-MODULE_NAME="main"
-debug "activated modules: $active_charts"
-
-
-# -----------------------------------------------------------------------------
-# check overwrites
-
-# enable work time reporting
-debug_time=
-test $debug -eq 1 && debug_time=tellwork
-
-# if we only need a specific chart, remove all the others
-if [ ! -z "${chart_only}" ]
-then
- debug "requested to run only for: '${chart_only}'"
- check_charts=
- for chart in $active_charts
- do
- if [ "$chart" = "$chart_only" ]
- then
- check_charts="$chart"
- break
- fi
- done
- active_charts="$check_charts"
-fi
-debug "activated charts: $active_charts"
-
-# stop if we just need a pre-check
-if [ $check -eq 1 ]
-then
- info "CHECK RESULT"
- info "Will run the charts: $active_charts"
- exit 0
-fi
-
-# -----------------------------------------------------------------------------
-
-cd "${TMP_DIR}" || exit 1
-
-# -----------------------------------------------------------------------------
-# create charts
-
-run_charts=
-for chart in $active_charts
-do
- MODULE_NAME="${chart}"
-
- debug "calling '$chart$charts_create()'..."
- $chart$charts_create
- if [ $? -eq 0 ]
- then
- run_charts="$run_charts $chart"
- debug "'$chart' initialized."
- else
- error "module's '$chart' function '$chart$charts_create()' reports failure."
- fi
-done
-MODULE_NAME="main"
-debug "run_charts='$run_charts'"
-
-
-# -----------------------------------------------------------------------------
-# update dimensions
-
-[ -z "$run_charts" ] && fatal "No charts to collect data from."
-
-declare -A charts_last_update=() charts_update_every=() charts_retries=() charts_next_update=() charts_run_counter=() charts_serial_failures=()
-global_update() {
- local exit_at \
- c=0 dt ret last_ms exec_start_ms exec_end_ms \
- chart now_charts=() next_charts=($run_charts) \
- next_ms x seconds millis
-
- # return the current time in ms in $now_ms
- ${current_time_ms}
-
- exit_at=$(( now_ms + (restart_timeout * 1000) ))
-
- for chart in $run_charts
- do
- eval "charts_update_every[$chart]=\$$chart$suffix_update_every"
- test -z "${charts_update_every[$chart]}" && charts_update_every[$chart]=$update_every
-
- eval "charts_retries[$chart]=\$$chart$suffix_retries"
- test -z "${charts_retries[$chart]}" && charts_retries[$chart]=10
-
- charts_last_update[$chart]=$((now_ms - (now_ms % (charts_update_every[$chart] * 1000) ) ))
- charts_next_update[$chart]=$(( charts_last_update[$chart] + (charts_update_every[$chart] * 1000) ))
- charts_run_counter[$chart]=0
- charts_serial_failures[$chart]=0
-
- echo "CHART netdata.plugin_chartsd_$chart '' 'Execution time for $chart plugin' 'milliseconds / run' charts.d netdata.plugin_charts area 145000 ${charts_update_every[$chart]}"
- echo "DIMENSION run_time 'run time' absolute 1 1"
- done
-
- # the main loop
- while [ "${#next_charts[@]}" -gt 0 ]
- do
- c=$((c + 1))
- now_charts=("${next_charts[@]}")
- next_charts=()
-
- # return the current time in ms in $now_ms
- ${current_time_ms}
-
- for chart in "${now_charts[@]}"
- do
- MODULE_NAME="${chart}"
-
- if [ ${now_ms} -ge ${charts_next_update[$chart]} ]
- then
- last_ms=${charts_last_update[$chart]}
- dt=$(( (now_ms - last_ms) ))
-
- charts_last_update[$chart]=${now_ms}
-
- while [ ${charts_next_update[$chart]} -lt ${now_ms} ]
- do
- charts_next_update[$chart]=$(( charts_next_update[$chart] + (charts_update_every[$chart] * 1000) ))
- done
-
- # the first call should not give a duration
- # so that netdata calibrates to current time
- dt=$(( dt * 1000 ))
- charts_run_counter[$chart]=$(( charts_run_counter[$chart] + 1 ))
- if [ ${charts_run_counter[$chart]} -eq 1 ]
- then
- dt=
- fi
-
- exec_start_ms=$now_ms
- $chart$charts_update $dt
- ret=$?
-
- # return the current time in ms in $now_ms
- ${current_time_ms}; exec_end_ms=$now_ms
-
- echo "BEGIN netdata.plugin_chartsd_$chart $dt"
- echo "SET run_time = $(( exec_end_ms - exec_start_ms ))"
- echo "END"
-
- if [ $ret -eq 0 ]
- then
- charts_serial_failures[$chart]=0
- next_charts+=($chart)
- else
- charts_serial_failures[$chart]=$(( charts_serial_failures[$chart] + 1 ))
-
- if [ ${charts_serial_failures[$chart]} -gt ${charts_retries[$chart]} ]
- then
- error "module's '$chart' update() function reported failure ${charts_serial_failures[$chart]} times. Disabling it."
- else
- error "module's '$chart' update() function reports failure. Will keep trying for a while."
- next_charts+=($chart)
- fi
- fi
- else
- next_charts+=($chart)
- fi
- done
- MODULE_NAME="${chart}"
-
- # wait the time you are required to
- next_ms=$((now_ms + (update_every * 1000 * 100) ))
- for x in "${charts_next_update[@]}"; do [ ${x} -lt ${next_ms} ] && next_ms=${x}; done
- next_ms=$((next_ms - now_ms))
-
- if [ ${LOOPSLEEPMS_HIGHRES} -eq 1 -a ${next_ms} -gt 0 ]
- then
- next_ms=$(( next_ms + current_time_ms_accuracy ))
- seconds=$(( next_ms / 1000 ))
- millis=$(( next_ms % 1000 ))
- if [ ${millis} -lt 10 ]
- then
- millis="00${millis}"
- elif [ ${millis} -lt 100 ]
- then
- millis="0${millis}"
- fi
-
- debug "sleeping for ${seconds}.${millis} seconds."
- ${mysleep} ${seconds}.${millis}
- else
- debug "sleeping for ${update_every} seconds."
- ${mysleep} $update_every
- fi
-
- test ${now_ms} -ge ${exit_at} && exit 0
- done
-
- fatal "nothing left to do, exiting..."
-}
-
-global_update
diff --git a/collectors/charts.d.plugin/charts.d.plugin.in b/collectors/charts.d.plugin/charts.d.plugin.in
index 3477894d..05a63875 100755
--- a/collectors/charts.d.plugin/charts.d.plugin.in
+++ b/collectors/charts.d.plugin/charts.d.plugin.in
@@ -17,7 +17,7 @@ export PATH="${PATH}:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
PROGRAM_FILE="$0"
PROGRAM_NAME="$(basename $0)"
-PROGRAM_NAME="${PROGRAM_NAME/.plugin}"
+PROGRAM_NAME="${PROGRAM_NAME/.plugin/}"
MODULE_NAME="main"
# -----------------------------------------------------------------------------
@@ -26,72 +26,69 @@ MODULE_NAME="main"
debug=0
TMP_DIR=
chartsd_cleanup() {
- trap '' EXIT QUIT HUP INT TERM
-
- if [ ! -z "$TMP_DIR" -a -d "$TMP_DIR" ]
- then
- [ $debug -eq 1 ] && echo >&2 "$PROGRAM_NAME: cleaning up temporary directory $TMP_DIR ..."
- rm -rf "$TMP_DIR"
- fi
- exit 0
+ trap '' EXIT QUIT HUP INT TERM
+
+ if [ ! -z "$TMP_DIR" -a -d "$TMP_DIR" ]; then
+ [ $debug -eq 1 ] && echo >&2 "$PROGRAM_NAME: cleaning up temporary directory $TMP_DIR ..."
+ rm -rf "$TMP_DIR"
+ fi
+ exit 0
}
trap chartsd_cleanup EXIT QUIT HUP INT TERM
-if [ $UID = "0" ]
-then
- TMP_DIR="$( mktemp -d /var/run/netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
+if [ $UID = "0" ]; then
+ TMP_DIR="$(mktemp -d /var/run/netdata-${PROGRAM_NAME}-XXXXXXXXXX)"
else
- TMP_DIR="$( mktemp -d /tmp/.netdata-${PROGRAM_NAME}-XXXXXXXXXX )"
+ TMP_DIR="$(mktemp -d /tmp/.netdata-${PROGRAM_NAME}-XXXXXXXXXX)"
fi
logdate() {
- date "+%Y-%m-%d %H:%M:%S"
+ date "+%Y-%m-%d %H:%M:%S"
}
log() {
- local status="${1}"
- shift
+ local status="${1}"
+ shift
- echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: ${*}"
+ echo >&2 "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: ${*}"
}
warning() {
- log WARNING "${@}"
+ log WARNING "${@}"
}
error() {
- log ERROR "${@}"
+ log ERROR "${@}"
}
info() {
- log INFO "${@}"
+ log INFO "${@}"
}
fatal() {
- log FATAL "${@}"
- echo "DISABLE"
- exit 1
+ log FATAL "${@}"
+ echo "DISABLE"
+ exit 1
}
debug() {
- [ $debug -eq 1 ] && log DEBUG "${@}"
+ [ $debug -eq 1 ] && log DEBUG "${@}"
}
# -----------------------------------------------------------------------------
# check a few commands
require_cmd() {
- local x=$(which "${1}" 2>/dev/null || command -v "${1}" 2>/dev/null)
- if [ -z "${x}" -o ! -x "${x}" ]
- then
- warning "command '${1}' is not found in ${PATH}."
- eval "${1^^}_CMD=\"\""
- return 1
- fi
-
- eval "${1^^}_CMD=\"${x}\""
- return 0
+ local x=$(which "${1}" 2>/dev/null || command -v "${1}" 2>/dev/null)
+ if [ -z "${x}" -o ! -x "${x}" ]; then
+ warning "command '${1}' is not found in ${PATH}."
+ eval "${1^^}_CMD=\"\""
+ return 1
+ fi
+
+ eval "${1^^}_CMD=\"${x}\""
+ return 0
}
require_cmd date || exit 1
@@ -108,7 +105,7 @@ require_cmd curl || exit 1
# -----------------------------------------------------------------------------
-[ $(( ${BASH_VERSINFO[0]} )) -lt 4 ] && fatal "BASH version 4 or later is required, but found version: ${BASH_VERSION}. Please upgrade."
+[ $((BASH_VERSINFO[0])) -lt 4 ] && fatal "BASH version 4 or later is required, but found version: ${BASH_VERSION}. Please upgrade."
info "started from '$PROGRAM_FILE' with options: $*"
@@ -117,7 +114,7 @@ info "started from '$PROGRAM_FILE' with options: $*"
# netdata exposes a few environment variables for us
[ -z "${NETDATA_PLUGINS_DIR}" ] && NETDATA_PLUGINS_DIR="$(dirname "${0}")"
-[ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="@configdir_POST@"
+[ -z "${NETDATA_USER_CONFIG_DIR}" ] && NETDATA_USER_CONFIG_DIR="@configdir_POST@"
[ -z "${NETDATA_STOCK_CONFIG_DIR}" ] && NETDATA_STOCK_CONFIG_DIR="@libconfigdir_POST@"
pluginsd="${NETDATA_PLUGINS_DIR}"
@@ -127,7 +124,7 @@ olduserconfd="${NETDATA_USER_CONFIG_DIR}"
chartsd="$pluginsd/../charts.d"
minimum_update_frequency="${NETDATA_UPDATE_EVERY-1}"
-update_every=${minimum_update_frequency} # this will be overwritten by the command line
+update_every=${minimum_update_frequency} # this will be overwritten by the command line
# work around for non BASH shells
charts_create="_create"
@@ -169,53 +166,46 @@ enable_all_charts="yes"
check=0
chart_only=
-while [ ! -z "$1" ]
-do
- if [ "$1" = "check" ]
- then
- check=1
- shift
- continue
- fi
-
- if [ "$1" = "debug" -o "$1" = "all" ]
- then
- debug=1
- shift
- continue
- fi
-
- if [ -f "$chartsd/$1.chart.sh" ]
- then
- debug=1
- chart_only="$( echo $1.chart.sh | sed "s/\.chart\.sh$//g" )"
- shift
- continue
- fi
-
- if [ -f "$chartsd/$1" ]
- then
- debug=1
- chart_only="$( echo $1 | sed "s/\.chart\.sh$//g" )"
- shift
- continue
- fi
-
- # number check
- n="$1"
- x=$(( n ))
- if [ "$x" = "$n" ]
- then
- shift
- update_every=$x
- [ $update_every -lt $minimum_update_frequency ] && update_every=$minimum_update_frequency
- continue
- fi
-
- fatal "Cannot understand parameter $1. Aborting."
+while [ ! -z "$1" ]; do
+ if [ "$1" = "check" ]; then
+ check=1
+ shift
+ continue
+ fi
+
+ if [ "$1" = "debug" -o "$1" = "all" ]; then
+ debug=1
+ shift
+ continue
+ fi
+
+ if [ -f "$chartsd/$1.chart.sh" ]; then
+ debug=1
+ chart_only="$(echo $1.chart.sh | sed "s/\.chart\.sh$//g")"
+ shift
+ continue
+ fi
+
+ if [ -f "$chartsd/$1" ]; then
+ debug=1
+ chart_only="$(echo $1 | sed "s/\.chart\.sh$//g")"
+ shift
+ continue
+ fi
+
+ # number check
+ n="$1"
+ x=$((n))
+ if [ "$x" = "$n" ]; then
+ shift
+ update_every=$x
+ [ $update_every -lt $minimum_update_frequency ] && update_every=$minimum_update_frequency
+ continue
+ fi
+
+ fatal "Cannot understand parameter $1. Aborting."
done
-
# -----------------------------------------------------------------------------
# loop control
@@ -223,7 +213,7 @@ done
LOOPSLEEPMS_HIGHRES=0
now_ms=
current_time_ms_default() {
- now_ms="$(date +'%s')000"
+ now_ms="$(date +'%s')000"
}
current_time_ms="current_time_ms_default"
current_time_ms_accuracy=1
@@ -238,20 +228,17 @@ source "$pluginsd/loopsleepms.sh.inc"
# -----------------------------------------------------------------------------
# load my configuration
-for myconfig in "${NETDATA_STOCK_CONFIG_DIR}/${PROGRAM_NAME}.conf" "${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf"
-do
- if [ -f "$myconfig" ]
- then
- source "$myconfig"
- if [ $? -ne 0 ]
- then
- error "Config file '$myconfig' loaded with errors."
- else
- info "Configuration file '$myconfig' loaded."
- fi
- else
- warning "Configuration file '$myconfig' not found."
- fi
+for myconfig in "${NETDATA_STOCK_CONFIG_DIR}/${PROGRAM_NAME}.conf" "${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf"; do
+ if [ -f "$myconfig" ]; then
+ source "$myconfig"
+ if [ $? -ne 0 ]; then
+ error "Config file '$myconfig' loaded with errors."
+ else
+ info "Configuration file '$myconfig' loaded."
+ fi
+ else
+ warning "Configuration file '$myconfig' not found."
+ fi
done
# make sure time_divisor is right
@@ -259,22 +246,20 @@ time_divisor=$((time_divisor))
[ $time_divisor -lt 10 ] && time_divisor=10
[ $time_divisor -gt 100 ] && time_divisor=100
-
# we check for the timeout command, after we load our
# configuration, so that the user may overwrite the
# timeout command we use, providing a function that
# can emulate the timeout command we need:
# > timeout SECONDS command ...
-if [ $check_for_timeout -eq 1 ]
- then
- require_cmd timeout || exit 1
+if [ $check_for_timeout -eq 1 ]; then
+ require_cmd timeout || exit 1
fi
# -----------------------------------------------------------------------------
# internal checks
# netdata passes the requested update frequency as the first argument
-update_every=$(( update_every + 1 - 1)) # makes sure it is a number
+update_every=$((update_every + 1 - 1)) # makes sure it is a number
test $update_every -eq 0 && update_every=1 # if it is zero, make it 1
# check the charts.d directory
@@ -284,39 +269,37 @@ test $update_every -eq 0 && update_every=1 # if it is zero, make it 1
# library functions
fixid() {
- echo "$*" |\
- tr -c "[A-Z][a-z][0-9]" "_" |\
- sed -e "s|^_\+||g" -e "s|_\+$||g" -e "s|_\+|_|g" |\
- tr "[A-Z]" "[a-z]"
+ echo "$*" |
+ tr -c "[A-Z][a-z][0-9]" "_" |
+ sed -e "s|^_\+||g" -e "s|_\+$||g" -e "s|_\+|_|g" |
+ tr "[A-Z]" "[a-z]"
}
run() {
- local ret pid="${BASHPID}" t
-
- if [ "z${1}" = "z-t" -a "${2}" != "0" ]
- then
- t="${2}"
- shift 2
- timeout ${t} "${@}" 2>"${TMP_DIR}/run.${pid}"
- ret=$?
- else
- "${@}" 2>"${TMP_DIR}/run.${pid}"
- ret=$?
- fi
-
- if [ ${ret} -ne 0 ]
- then
- {
- printf "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: command '"
- printf "%q " "${@}"
- printf "' failed with code ${ret}:\n --- BEGIN TRACE ---\n"
- cat "${TMP_DIR}/run.${pid}"
- printf " --- END TRACE ---\n"
- } >&2
- fi
- rm "${TMP_DIR}/run.${pid}"
-
- return ${ret}
+ local ret pid="${BASHPID}" t
+
+ if [ "z${1}" = "z-t" -a "${2}" != "0" ]; then
+ t="${2}"
+ shift 2
+ timeout ${t} "${@}" 2>"${TMP_DIR}/run.${pid}"
+ ret=$?
+ else
+ "${@}" 2>"${TMP_DIR}/run.${pid}"
+ ret=$?
+ fi
+
+ if [ ${ret} -ne 0 ]; then
+ {
+ printf "$(logdate): ${PROGRAM_NAME}: ${status}: ${MODULE_NAME}: command '"
+ printf "%q " "${@}"
+ printf "' failed with code ${ret}:\n --- BEGIN TRACE ---\n"
+ cat "${TMP_DIR}/run.${pid}"
+ printf " --- END TRACE ---\n"
+ } >&2
+ fi
+ rm "${TMP_DIR}/run.${pid}"
+
+ return ${ret}
}
# convert any floating point number
@@ -325,166 +308,155 @@ run() {
# so that no fork is necessary
# the multiplier must be a power of 10
float2int() {
- local f m="$2" a b l v=($1)
- f=${v[0]}
-
- # the length of the multiplier - 1
- l=$(( ${#m} - 1 ))
-
- # check if the number is in scientific notation
- if [[ ${f} =~ ^[[:space:]]*(-)?[0-9.]+(e|E)(\+|-)[0-9]+ ]]
- then
- # convert it to decimal
- # unfortunately, this fork cannot be avoided
- # if you know of a way to avoid it, please let me know
- f=$(printf "%0.${l}f" ${f})
- fi
-
- # split the floating point number
- # in integer (a) and decimal (b)
- a=${f/.*/}
- b=${f/*./}
-
- # if the integer part is missing
- # set it to zero
- [ -z "${a}" ] && a="0"
-
- # strip leading zeros from the integer part
- # base 10 convertion
- a=$((10#$a))
-
- # check the length of the decimal part
- # against the length of the multiplier
- if [ ${#b} -gt ${l} ]
- then
- # too many digits - take the most significant
- b=${b:0:${l}}
-
- elif [ ${#b} -lt ${l} ]
- then
- # too few digits - pad with zero on the right
- local z="00000000000000000000000" r=$((l - ${#b}))
- b="${b}${z:0:${r}}"
- fi
-
- # strip leading zeros from the decimal part
- # base 10 convertion
- b=$((10#$b))
-
- # store the result
- FLOAT2INT_RESULT=$(( (a * m) + b ))
+ local f m="$2" a b l v=($1)
+ f=${v[0]}
+
+ # the length of the multiplier - 1
+ l=$((${#m} - 1))
+
+ # check if the number is in scientific notation
+ if [[ ${f} =~ ^[[:space:]]*(-)?[0-9.]+(e|E)(\+|-)[0-9]+ ]]; then
+ # convert it to decimal
+ # unfortunately, this fork cannot be avoided
+ # if you know of a way to avoid it, please let me know
+ f=$(printf "%0.${l}f" ${f})
+ fi
+
+ # split the floating point number
+ # in integer (a) and decimal (b)
+ a=${f/.*/}
+ b=${f/*./}
+
+ # if the integer part is missing
+ # set it to zero
+ [ -z "${a}" ] && a="0"
+
+ # strip leading zeros from the integer part
+ # base 10 convertion
+ a=$((10#$a))
+
+ # check the length of the decimal part
+ # against the length of the multiplier
+ if [ ${#b} -gt ${l} ]; then
+ # too many digits - take the most significant
+ b=${b:0:l}
+
+ elif [ ${#b} -lt ${l} ]; then
+ # too few digits - pad with zero on the right
+ local z="00000000000000000000000" r=$((l - ${#b}))
+ b="${b}${z:0:r}"
+ fi
+
+ # strip leading zeros from the decimal part
+ # base 10 convertion
+ b=$((10#$b))
+
+ # store the result
+ FLOAT2INT_RESULT=$(((a * m) + b))
}
-
# -----------------------------------------------------------------------------
# charts check functions
all_charts() {
- cd "$chartsd"
- [ $? -ne 0 ] && error "cannot cd to $chartsd" && return 1
+ cd "$chartsd"
+ [ $? -ne 0 ] && error "cannot cd to $chartsd" && return 1
- ls *.chart.sh | sed "s/\.chart\.sh$//g"
+ ls *.chart.sh | sed "s/\.chart\.sh$//g"
}
declare -A charts_enable_keyword=(
- ['apache']="force"
- ['cpu_apps']="force"
- ['cpufreq']="force"
- ['example']="force"
- ['exim']="force"
- ['hddtemp']="force"
- ['load_average']="force"
- ['mem_apps']="force"
- ['mysql']="force"
- ['nginx']="force"
- ['phpfpm']="force"
- ['postfix']="force"
- ['sensors']="force"
- ['squid']="force"
- ['tomcat']="force"
- )
+ ['apache']="force"
+ ['cpu_apps']="force"
+ ['cpufreq']="force"
+ ['example']="force"
+ ['exim']="force"
+ ['hddtemp']="force"
+ ['load_average']="force"
+ ['mem_apps']="force"
+ ['mysql']="force"
+ ['nginx']="force"
+ ['phpfpm']="force"
+ ['postfix']="force"
+ ['sensors']="force"
+ ['squid']="force"
+ ['tomcat']="force"
+)
all_enabled_charts() {
- local charts= enabled= required=
-
- # find all enabled charts
-
- for chart in $( all_charts )
- do
- MODULE_NAME="${chart}"
-
- eval "enabled=\$$chart"
- if [ -z "${enabled}" ]
- then
- enabled="${enable_all_charts}"
- fi
-
- required="${charts_enable_keyword[${chart}]}"
- [ -z "${required}" ] && required="yes"
-
- if [ ! "${enabled}" = "${required}" ]
- then
- info "is disabled. Add a line with $chart=$required in '${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf' to enable it (or remove the line that disables it)."
- else
- debug "is enabled for auto-detection."
- local charts="$charts $chart"
- fi
- done
- MODULE_NAME="main"
-
- local charts2=
- for chart in $charts
- do
- MODULE_NAME="${chart}"
-
- # check the enabled charts
- local check="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_check()" )"
- if [ -z "$check" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_check() function. Disabling it."
- continue
- fi
-
- local create="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_create()" )"
- if [ -z "$create" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_create() function. Disabling it."
- continue
- fi
-
- local update="$( cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_update()" )"
- if [ -z "$update" ]
- then
- error "module '$chart' does not seem to have a $chart$charts_update() function. Disabling it."
- continue
- fi
-
- # check its config
- #if [ -f "$userconfd/$chart.conf" ]
- #then
- # if [ ! -z "$( cat "$userconfd/$chart.conf" | sed "s/^ \+//g" | grep -v "^$" | grep -v "^#" | grep -v "^$chart$charts_undescore" )" ]
- # then
- # error "module's $chart config $userconfd/$chart.conf should only have lines starting with $chart$charts_undescore . Disabling it."
- # continue
- # fi
- #fi
-
- #if [ $dryrunner -eq 1 ]
- # then
- # "$pluginsd/charts.d.dryrun-helper.sh" "$chart" "$chartsd/$chart.chart.sh" "$userconfd/$chart.conf" >/dev/null
- # if [ $? -ne 0 ]
- # then
- # error "module's $chart did not pass the dry run check. This means it uses global variables not starting with $chart. Disabling it."
- # continue
- # fi
- #fi
-
- local charts2="$charts2 $chart"
- done
- MODULE_NAME="main"
-
- echo $charts2
- debug "enabled charts: $charts2"
+ local charts= enabled= required=
+
+ # find all enabled charts
+
+ for chart in $(all_charts); do
+ MODULE_NAME="${chart}"
+
+ eval "enabled=\$$chart"
+ if [ -z "${enabled}" ]; then
+ enabled="${enable_all_charts}"
+ fi
+
+ required="${charts_enable_keyword[${chart}]}"
+ [ -z "${required}" ] && required="yes"
+
+ if [ ! "${enabled}" = "${required}" ]; then
+ info "is disabled. Add a line with $chart=$required in '${NETDATA_USER_CONFIG_DIR}/${PROGRAM_NAME}.conf' to enable it (or remove the line that disables it)."
+ else
+ debug "is enabled for auto-detection."
+ local charts="$charts $chart"
+ fi
+ done
+ MODULE_NAME="main"
+
+ local charts2=
+ for chart in $charts; do
+ MODULE_NAME="${chart}"
+
+ # check the enabled charts
+ local check="$(cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_check()")"
+ if [ -z "$check" ]; then
+ error "module '$chart' does not seem to have a $chart$charts_check() function. Disabling it."
+ continue
+ fi
+
+ local create="$(cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_create()")"
+ if [ -z "$create" ]; then
+ error "module '$chart' does not seem to have a $chart$charts_create() function. Disabling it."
+ continue
+ fi
+
+ local update="$(cat "$chartsd/$chart.chart.sh" | sed "s/^ \+//g" | grep "^$chart$charts_update()")"
+ if [ -z "$update" ]; then
+ error "module '$chart' does not seem to have a $chart$charts_update() function. Disabling it."
+ continue
+ fi
+
+ # check its config
+ #if [ -f "$userconfd/$chart.conf" ]
+ #then
+ # if [ ! -z "$( cat "$userconfd/$chart.conf" | sed "s/^ \+//g" | grep -v "^$" | grep -v "^#" | grep -v "^$chart$charts_undescore" )" ]
+ # then
+ # error "module's $chart config $userconfd/$chart.conf should only have lines starting with $chart$charts_undescore . Disabling it."
+ # continue
+ # fi
+ #fi
+
+ #if [ $dryrunner -eq 1 ]
+ # then
+ # "$pluginsd/charts.d.dryrun-helper.sh" "$chart" "$chartsd/$chart.chart.sh" "$userconfd/$chart.conf" >/dev/null
+ # if [ $? -ne 0 ]
+ # then
+ # error "module's $chart did not pass the dry run check. This means it uses global variables not starting with $chart. Disabling it."
+ # continue
+ # fi
+ #fi
+
+ local charts2="$charts2 $chart"
+ done
+ MODULE_NAME="main"
+
+ echo $charts2
+ debug "enabled charts: $charts2"
}
# -----------------------------------------------------------------------------
@@ -493,63 +465,56 @@ all_enabled_charts() {
suffix_retries="_retries"
suffix_update_every="_update_every"
active_charts=
-for chart in $( all_enabled_charts )
-do
- MODULE_NAME="${chart}"
-
- debug "loading module: '$chartsd/$chart.chart.sh'"
-
- source "$chartsd/$chart.chart.sh"
- [ $? -ne 0 ] && warning "Module '$chartsd/$chart.chart.sh' loaded with errors."
-
- # first load the stock config
- if [ -f "$stockconfd/$chart.conf" ]
- then
- debug "loading module configuration: '$stockconfd/$chart.conf'"
- source "$stockconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$stockconfd/$chart.conf' loaded with errors."
- else
- debug "not found module configuration: '$stockconfd/$chart.conf'"
- fi
-
- # then load the user config (it overwrites the stock)
- if [ -f "$userconfd/$chart.conf" ]
- then
- debug "loading module configuration: '$userconfd/$chart.conf'"
- source "$userconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$userconfd/$chart.conf' loaded with errors."
- else
- debug "not found module configuration: '$userconfd/$chart.conf'"
-
- if [ -f "$olduserconfd/$chart.conf" ]
- then
- # support for very old netdata that had the charts.d module configs in /etc/netdata
- info "loading module configuration from obsolete location: '$olduserconfd/$chart.conf'"
- source "$olduserconfd/$chart.conf"
- [ $? -ne 0 ] && warning "Config file '$olduserconfd/$chart.conf' loaded with errors."
- fi
- fi
-
- eval "dt=\$$chart$suffix_update_every"
- dt=$(( dt + 1 - 1 )) # make sure it is a number
- if [ $dt -lt $update_every ]
- then
- eval "$chart$suffix_update_every=$update_every"
- fi
-
- $chart$charts_check
- if [ $? -eq 0 ]
- then
- debug "module '$chart' activated"
- active_charts="$active_charts $chart"
- else
- error "module's '$chart' check() function reports failure."
- fi
+for chart in $(all_enabled_charts); do
+ MODULE_NAME="${chart}"
+
+ debug "loading module: '$chartsd/$chart.chart.sh'"
+
+ source "$chartsd/$chart.chart.sh"
+ [ $? -ne 0 ] && warning "Module '$chartsd/$chart.chart.sh' loaded with errors."
+
+ # first load the stock config
+ if [ -f "$stockconfd/$chart.conf" ]; then
+ debug "loading module configuration: '$stockconfd/$chart.conf'"
+ source "$stockconfd/$chart.conf"
+ [ $? -ne 0 ] && warning "Config file '$stockconfd/$chart.conf' loaded with errors."
+ else
+ debug "not found module configuration: '$stockconfd/$chart.conf'"
+ fi
+
+ # then load the user config (it overwrites the stock)
+ if [ -f "$userconfd/$chart.conf" ]; then
+ debug "loading module configuration: '$userconfd/$chart.conf'"
+ source "$userconfd/$chart.conf"
+ [ $? -ne 0 ] && warning "Config file '$userconfd/$chart.conf' loaded with errors."
+ else
+ debug "not found module configuration: '$userconfd/$chart.conf'"
+
+ if [ -f "$olduserconfd/$chart.conf" ]; then
+ # support for very old netdata that had the charts.d module configs in /etc/netdata
+ info "loading module configuration from obsolete location: '$olduserconfd/$chart.conf'"
+ source "$olduserconfd/$chart.conf"
+ [ $? -ne 0 ] && warning "Config file '$olduserconfd/$chart.conf' loaded with errors."
+ fi
+ fi
+
+ eval "dt=\$$chart$suffix_update_every"
+ dt=$((dt + 1 - 1)) # make sure it is a number
+ if [ $dt -lt $update_every ]; then
+ eval "$chart$suffix_update_every=$update_every"
+ fi
+
+ $chart$charts_check
+ if [ $? -eq 0 ]; then
+ debug "module '$chart' activated"
+ active_charts="$active_charts $chart"
+ else
+ error "module's '$chart' check() function reports failure."
+ fi
done
MODULE_NAME="main"
debug "activated modules: $active_charts"
-
# -----------------------------------------------------------------------------
# check overwrites
@@ -558,28 +523,24 @@ debug_time=
test $debug -eq 1 && debug_time=tellwork
# if we only need a specific chart, remove all the others
-if [ ! -z "${chart_only}" ]
-then
- debug "requested to run only for: '${chart_only}'"
- check_charts=
- for chart in $active_charts
- do
- if [ "$chart" = "$chart_only" ]
- then
- check_charts="$chart"
- break
- fi
- done
- active_charts="$check_charts"
+if [ ! -z "${chart_only}" ]; then
+ debug "requested to run only for: '${chart_only}'"
+ check_charts=
+ for chart in $active_charts; do
+ if [ "$chart" = "$chart_only" ]; then
+ check_charts="$chart"
+ break
+ fi
+ done
+ active_charts="$check_charts"
fi
debug "activated charts: $active_charts"
# stop if we just need a pre-check
-if [ $check -eq 1 ]
-then
- info "CHECK RESULT"
- info "Will run the charts: $active_charts"
- exit 0
+if [ $check -eq 1 ]; then
+ info "CHECK RESULT"
+ info "Will run the charts: $active_charts"
+ exit 0
fi
# -----------------------------------------------------------------------------
@@ -590,24 +551,21 @@ cd "${TMP_DIR}" || exit 1
# create charts
run_charts=
-for chart in $active_charts
-do
- MODULE_NAME="${chart}"
-
- debug "calling '$chart$charts_create()'..."
- $chart$charts_create
- if [ $? -eq 0 ]
- then
- run_charts="$run_charts $chart"
- debug "'$chart' initialized."
- else
- error "module's '$chart' function '$chart$charts_create()' reports failure."
- fi
+for chart in $active_charts; do
+ MODULE_NAME="${chart}"
+
+ debug "calling '$chart$charts_create()'..."
+ $chart$charts_create
+ if [ $? -eq 0 ]; then
+ run_charts="$run_charts $chart"
+ debug "'$chart' initialized."
+ else
+ error "module's '$chart' function '$chart$charts_create()' reports failure."
+ fi
done
MODULE_NAME="main"
debug "run_charts='$run_charts'"
-
# -----------------------------------------------------------------------------
# update dimensions
@@ -615,129 +573,119 @@ debug "run_charts='$run_charts'"
declare -A charts_last_update=() charts_update_every=() charts_retries=() charts_next_update=() charts_run_counter=() charts_serial_failures=()
global_update() {
- local exit_at \
- c=0 dt ret last_ms exec_start_ms exec_end_ms \
- chart now_charts=() next_charts=($run_charts) \
- next_ms x seconds millis
-
- # return the current time in ms in $now_ms
- ${current_time_ms}
-
- exit_at=$(( now_ms + (restart_timeout * 1000) ))
-
- for chart in $run_charts
- do
- eval "charts_update_every[$chart]=\$$chart$suffix_update_every"
- test -z "${charts_update_every[$chart]}" && charts_update_every[$chart]=$update_every
-
- eval "charts_retries[$chart]=\$$chart$suffix_retries"
- test -z "${charts_retries[$chart]}" && charts_retries[$chart]=10
-
- charts_last_update[$chart]=$((now_ms - (now_ms % (charts_update_every[$chart] * 1000) ) ))
- charts_next_update[$chart]=$(( charts_last_update[$chart] + (charts_update_every[$chart] * 1000) ))
- charts_run_counter[$chart]=0
- charts_serial_failures[$chart]=0
-
- echo "CHART netdata.plugin_chartsd_$chart '' 'Execution time for $chart plugin' 'milliseconds / run' charts.d netdata.plugin_charts area 145000 ${charts_update_every[$chart]}"
- echo "DIMENSION run_time 'run time' absolute 1 1"
- done
-
- # the main loop
- while [ "${#next_charts[@]}" -gt 0 ]
- do
- c=$((c + 1))
- now_charts=("${next_charts[@]}")
- next_charts=()
-
- # return the current time in ms in $now_ms
- ${current_time_ms}
-
- for chart in "${now_charts[@]}"
- do
- MODULE_NAME="${chart}"
-
- if [ ${now_ms} -ge ${charts_next_update[$chart]} ]
- then
- last_ms=${charts_last_update[$chart]}
- dt=$(( (now_ms - last_ms) ))
-
- charts_last_update[$chart]=${now_ms}
-
- while [ ${charts_next_update[$chart]} -lt ${now_ms} ]
- do
- charts_next_update[$chart]=$(( charts_next_update[$chart] + (charts_update_every[$chart] * 1000) ))
- done
-
- # the first call should not give a duration
- # so that netdata calibrates to current time
- dt=$(( dt * 1000 ))
- charts_run_counter[$chart]=$(( charts_run_counter[$chart] + 1 ))
- if [ ${charts_run_counter[$chart]} -eq 1 ]
- then
- dt=
- fi
-
- exec_start_ms=$now_ms
- $chart$charts_update $dt
- ret=$?
-
- # return the current time in ms in $now_ms
- ${current_time_ms}; exec_end_ms=$now_ms
-
- echo "BEGIN netdata.plugin_chartsd_$chart $dt"
- echo "SET run_time = $(( exec_end_ms - exec_start_ms ))"
- echo "END"
-
- if [ $ret -eq 0 ]
- then
- charts_serial_failures[$chart]=0
- next_charts+=($chart)
- else
- charts_serial_failures[$chart]=$(( charts_serial_failures[$chart] + 1 ))
-
- if [ ${charts_serial_failures[$chart]} -gt ${charts_retries[$chart]} ]
- then
- error "module's '$chart' update() function reported failure ${charts_serial_failures[$chart]} times. Disabling it."
- else
- error "module's '$chart' update() function reports failure. Will keep trying for a while."
- next_charts+=($chart)
- fi
- fi
- else
- next_charts+=($chart)
- fi
- done
- MODULE_NAME="${chart}"
-
- # wait the time you are required to
- next_ms=$((now_ms + (update_every * 1000 * 100) ))
- for x in "${charts_next_update[@]}"; do [ ${x} -lt ${next_ms} ] && next_ms=${x}; done
- next_ms=$((next_ms - now_ms))
-
- if [ ${LOOPSLEEPMS_HIGHRES} -eq 1 -a ${next_ms} -gt 0 ]
- then
- next_ms=$(( next_ms + current_time_ms_accuracy ))
- seconds=$(( next_ms / 1000 ))
- millis=$(( next_ms % 1000 ))
- if [ ${millis} -lt 10 ]
- then
- millis="00${millis}"
- elif [ ${millis} -lt 100 ]
- then
- millis="0${millis}"
- fi
-
- debug "sleeping for ${seconds}.${millis} seconds."
- ${mysleep} ${seconds}.${millis}
- else
- debug "sleeping for ${update_every} seconds."
- ${mysleep} $update_every
- fi
-
- test ${now_ms} -ge ${exit_at} && exit 0
- done
-
- fatal "nothing left to do, exiting..."
+ local exit_at \
+ c=0 dt ret last_ms exec_start_ms exec_end_ms \
+ chart now_charts=() next_charts=($run_charts) \
+ next_ms x seconds millis
+
+ # return the current time in ms in $now_ms
+ ${current_time_ms}
+
+ exit_at=$((now_ms + (restart_timeout * 1000)))
+
+ for chart in $run_charts; do
+ eval "charts_update_every[$chart]=\$$chart$suffix_update_every"
+ test -z "${charts_update_every[$chart]}" && charts_update_every[$chart]=$update_every
+
+ eval "charts_retries[$chart]=\$$chart$suffix_retries"
+ test -z "${charts_retries[$chart]}" && charts_retries[$chart]=10
+
+ charts_last_update[$chart]=$((now_ms - (now_ms % (charts_update_every[$chart] * 1000))))
+ charts_next_update[$chart]=$((charts_last_update[$chart] + (charts_update_every[$chart] * 1000)))
+ charts_run_counter[$chart]=0
+ charts_serial_failures[$chart]=0
+
+ echo "CHART netdata.plugin_chartsd_$chart '' 'Execution time for $chart plugin' 'milliseconds / run' charts.d netdata.plugin_charts area 145000 ${charts_update_every[$chart]}"
+ echo "DIMENSION run_time 'run time' absolute 1 1"
+ done
+
+ # the main loop
+ while [ "${#next_charts[@]}" -gt 0 ]; do
+ c=$((c + 1))
+ now_charts=("${next_charts[@]}")
+ next_charts=()
+
+ # return the current time in ms in $now_ms
+ ${current_time_ms}
+
+ for chart in "${now_charts[@]}"; do
+ MODULE_NAME="${chart}"
+
+ if [ ${now_ms} -ge ${charts_next_update[$chart]} ]; then
+ last_ms=${charts_last_update[$chart]}
+ dt=$((now_ms - last_ms))
+
+ charts_last_update[$chart]=${now_ms}
+
+ while [ ${charts_next_update[$chart]} -lt ${now_ms} ]; do
+ charts_next_update[$chart]=$((charts_next_update[$chart] + (charts_update_every[$chart] * 1000)))
+ done
+
+ # the first call should not give a duration
+ # so that netdata calibrates to current time
+ dt=$((dt * 1000))
+ charts_run_counter[$chart]=$((charts_run_counter[$chart] + 1))
+ if [ ${charts_run_counter[$chart]} -eq 1 ]; then
+ dt=
+ fi
+
+ exec_start_ms=$now_ms
+ $chart$charts_update $dt
+ ret=$?
+
+ # return the current time in ms in $now_ms
+ ${current_time_ms}
+ exec_end_ms=$now_ms
+
+ echo "BEGIN netdata.plugin_chartsd_$chart $dt"
+ echo "SET run_time = $((exec_end_ms - exec_start_ms))"
+ echo "END"
+
+ if [ $ret -eq 0 ]; then
+ charts_serial_failures[$chart]=0
+ next_charts+=($chart)
+ else
+ charts_serial_failures[$chart]=$((charts_serial_failures[$chart] + 1))
+
+ if [ ${charts_serial_failures[$chart]} -gt ${charts_retries[$chart]} ]; then
+ error "module's '$chart' update() function reported failure ${charts_serial_failures[$chart]} times. Disabling it."
+ else
+ error "module's '$chart' update() function reports failure. Will keep trying for a while."
+ next_charts+=($chart)
+ fi
+ fi
+ else
+ next_charts+=($chart)
+ fi
+ done
+ MODULE_NAME="${chart}"
+
+ # wait the time you are required to
+ next_ms=$((now_ms + (update_every * 1000 * 100)))
+ for x in "${charts_next_update[@]}"; do [ ${x} -lt ${next_ms} ] && next_ms=${x}; done
+ next_ms=$((next_ms - now_ms))
+
+ if [ ${LOOPSLEEPMS_HIGHRES} -eq 1 -a ${next_ms} -gt 0 ]; then
+ next_ms=$((next_ms + current_time_ms_accuracy))
+ seconds=$((next_ms / 1000))
+ millis=$((next_ms % 1000))
+ if [ ${millis} -lt 10 ]; then
+ millis="00${millis}"
+ elif [ ${millis} -lt 100 ]; then
+ millis="0${millis}"
+ fi
+
+ debug "sleeping for ${seconds}.${millis} seconds."
+ ${mysleep} ${seconds}.${millis}
+ else
+ debug "sleeping for ${update_every} seconds."
+ ${mysleep} $update_every
+ fi
+
+ test ${now_ms} -ge ${exit_at} && exit 0
+ done
+
+ fatal "nothing left to do, exiting..."
}
global_update
diff --git a/collectors/charts.d.plugin/cpu_apps/README.md b/collectors/charts.d.plugin/cpu_apps/README.md
index cd8adf0a..a32a6330 100644
--- a/collectors/charts.d.plugin/cpu_apps/README.md
+++ b/collectors/charts.d.plugin/cpu_apps/README.md
@@ -1,2 +1,6 @@
+# cpu_apps
+
> THIS MODULE IS OBSOLETE.
-> USE APPS.PLUGIN.
+> USE [APPS.PLUGIN](../../apps.plugin).
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fcpu_apps%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh b/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
index 869464af..e91c46d5 100644
--- a/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
+++ b/collectors/charts.d.plugin/cpu_apps/cpu_apps.chart.sh
@@ -23,8 +23,7 @@ cpu_apps_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- if [ -z "$cpu_apps_apps" ]
- then
+ if [ -z "$cpu_apps_apps" ]; then
error "manual configuration required: please set cpu_apps_apps='command1 command2 ...' in $confd/cpu_apps_apps.conf"
return 1
fi
@@ -38,8 +37,7 @@ cpu_apps_create() {
echo "CHART chartsd_apps.cpu '' 'Apps CPU' 'milliseconds / $cpu_apps_update_every sec' apps apps stacked 20001 $cpu_apps_update_every"
local x=
- for x in $cpu_apps_apps
- do
+ for x in $cpu_apps_apps; do
echo "DIMENSION $x $x incremental 1000 $cpu_apps_clockticks"
# this string is needed later in the update() function
@@ -55,15 +53,15 @@ cpu_apps_update() {
# remember: KEEP IT SIMPLE AND SHORT
echo "BEGIN chartsd_apps.cpu"
- ps -o pid,comm -C "$cpu_apps_apps" |\
- grep -v "COMMAND" |\
+ ps -o pid,comm -C "$cpu_apps_apps" |
+ grep -v "COMMAND" |
(
- while read pid name
- do
- echo "$name+=`cat /proc/$pid/stat | cut -d ' ' -f 14-15`"
+ while read pid name; do
+ echo "$name+=$(cat /proc/$pid/stat | cut -d ' ' -f 14-15)"
done
- ) |\
- ( sed -e "s/ \+/ /g" -e "s/ /+/g";
+ ) |
+ (
+ sed -e "s/ \+/ /g" -e "s/ /+/g"
echo "$cpu_apps_bc_finalze"
) | bc
echo "END"
diff --git a/collectors/charts.d.plugin/cpufreq/README.md b/collectors/charts.d.plugin/cpufreq/README.md
index d82951aa..84883f58 100644
--- a/collectors/charts.d.plugin/cpufreq/README.md
+++ b/collectors/charts.d.plugin/cpufreq/README.md
@@ -1,2 +1,6 @@
+# cpufreq
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE THE [PROC PLUGIN](../../proc.plugin) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fcpufreq%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh b/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh
index 1fc6caab..68708d91 100644
--- a/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh
+++ b/collectors/charts.d.plugin/cpufreq/cpufreq.chart.sh
@@ -30,7 +30,7 @@ cpufreq_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- [ -z "$( cpufreq_find_all_files "$cpufreq_sys_dir" )" ] && return 1
+ [ -z "$(cpufreq_find_all_files "$cpufreq_sys_dir")" ] && return 1
return 0
}
@@ -47,16 +47,15 @@ cpufreq_create() {
echo >>"$TMP_DIR/cpufreq.sh" "echo \"BEGIN cpu.cpufreq \$1\""
i=0
- for file in $( cpufreq_find_all_files "$cpufreq_sys_dir" | sort -u )
- do
- i=$(( i + 1 ))
- dir=$( dirname "$file" )
+ for file in $(cpufreq_find_all_files "$cpufreq_sys_dir" | sort -u); do
+ i=$((i + 1))
+ dir=$(dirname "$file")
cpu=
- [ -f "$dir/affected_cpus" ] && cpu=$( cat "$dir/affected_cpus" )
+ [ -f "$dir/affected_cpus" ] && cpu=$(cat "$dir/affected_cpus")
[ -z "$cpu" ] && cpu="$i.a"
- id="$( fixid "cpu$cpu" )"
+ id="$(fixid "cpu$cpu")"
debug "file='$file', dir='$dir', cpu='$cpu', id='$id'"
@@ -68,7 +67,7 @@ cpufreq_create() {
[ $cpufreq_source_update -eq 1 ] && echo >>"$TMP_DIR/cpufreq.sh" "}"
# ok, load the function cpufreq_update() we created
- # shellcheck disable=SC1090
+ # shellcheck disable=SC1090
[ $cpufreq_source_update -eq 1 ] && . "$TMP_DIR/cpufreq.sh"
return 0
@@ -82,9 +81,8 @@ cpufreq_update() {
# do all the work to collect / calculate the values
# for each dimension
# remember: KEEP IT SIMPLE AND SHORT
- # shellcheck disable=SC1090
+ # shellcheck disable=SC1090
[ $cpufreq_source_update -eq 0 ] && . "$TMP_DIR/cpufreq.sh" "$1"
return 0
}
-
diff --git a/collectors/charts.d.plugin/example/README.md b/collectors/charts.d.plugin/example/README.md
index bfd5e210..e62f7677 100644
--- a/collectors/charts.d.plugin/example/README.md
+++ b/collectors/charts.d.plugin/example/README.md
@@ -1,2 +1,6 @@
+# Example
+
This is just an example charts.d data collector.
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fexample%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/example/example.chart.sh b/collectors/charts.d.plugin/example/example.chart.sh
index 1562c597..8bae570a 100644
--- a/collectors/charts.d.plugin/example/example.chart.sh
+++ b/collectors/charts.d.plugin/example/example.chart.sh
@@ -44,23 +44,20 @@ example_get() {
example_value1=$RANDOM
example_value2=$RANDOM
example_value3=$RANDOM
- example_value4=$((8192 + (RANDOM * 16383 / 32767) ))
+ example_value4=$((8192 + (RANDOM * 16383 / 32767)))
- if [ $example_count -gt 0 ]
- then
+ if [ $example_count -gt 0 ]; then
example_count=$((example_count - 1))
- [ $example_last -gt 16383 ] && example_value4=$((example_last + (RANDOM * ( (32767 - example_last) / 2) / 32767)))
+ [ $example_last -gt 16383 ] && example_value4=$((example_last + (RANDOM * ((32767 - example_last) / 2) / 32767)))
[ $example_last -le 16383 ] && example_value4=$((example_last - (RANDOM * (example_last / 2) / 32767)))
else
- example_count=$((1 + (RANDOM * 5 / 32767) ))
+ example_count=$((1 + (RANDOM * 5 / 32767)))
- if [ $example_last -gt 16383 ] && [ $example_value4 -gt 16383 ]
- then
+ if [ $example_last -gt 16383 ] && [ $example_value4 -gt 16383 ]; then
example_value4=$((example_value4 - 16383))
fi
- if [ $example_last -le 16383 ] && [ $example_value4 -lt 16383 ]
- then
+ if [ $example_last -le 16383 ] && [ $example_value4 -lt 16383 ]; then
example_value4=$((example_value4 + 16383))
fi
fi
diff --git a/collectors/charts.d.plugin/exim/README.md b/collectors/charts.d.plugin/exim/README.md
index d82951aa..b4c85389 100644
--- a/collectors/charts.d.plugin/exim/README.md
+++ b/collectors/charts.d.plugin/exim/README.md
@@ -1,2 +1,6 @@
+# exim
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/exim) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fexim%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/exim/exim.chart.sh b/collectors/charts.d.plugin/exim/exim.chart.sh
index 8099a724..7b0ef70d 100644
--- a/collectors/charts.d.plugin/exim/exim.chart.sh
+++ b/collectors/charts.d.plugin/exim/exim.chart.sh
@@ -17,14 +17,12 @@ exim_update_every=5
exim_priority=60000
exim_check() {
- 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 ]
- then
+ 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 ]; then
error "permission denied - please set 'queue_list_requires_admin = false' in your exim options file"
return 1
fi
@@ -33,16 +31,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 = $(run "${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/collectors/charts.d.plugin/hddtemp/README.md b/collectors/charts.d.plugin/hddtemp/README.md
index 98f18900..86a2e19e 100644
--- a/collectors/charts.d.plugin/hddtemp/README.md
+++ b/collectors/charts.d.plugin/hddtemp/README.md
@@ -1,8 +1,8 @@
-> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
-
# hddtemp
+> THIS MODULE IS OBSOLETE.
+> USE [THE PYTHON ONE](../../python.d.plugin/hddtemp) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
The plugin will collect temperatures from disks
It will create one chart with all active disks
@@ -26,3 +26,5 @@ hddtemp_disks=()
```
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fhddtemp%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh b/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh
index e9031098..a4cef3c3 100644
--- a/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh
+++ b/collectors/charts.d.plugin/hddtemp/hddtemp.chart.sh
@@ -21,7 +21,7 @@ hddtemp_priority=90000
# _check is called once, to find out if this chart should be enabled or not
hddtemp_check() {
- require_cmd nc || return 1
+ require_cmd nc || return 1
run nc $hddtemp_host $hddtemp_port && return 0 || return 1
}
@@ -29,17 +29,17 @@ hddtemp_check() {
hddtemp_create() {
if [ ${#hddtemp_disks[@]} -eq 0 ]; then
local all
- all=$(nc $hddtemp_host $hddtemp_port )
+ all=$(nc $hddtemp_host $hddtemp_port)
unset hddtemp_disks
# shellcheck disable=SC2190,SC2207
- hddtemp_disks=( $(grep -Po '/dev/[^|]+' <<< "$all" | cut -c 6-) )
+ hddtemp_disks=($(grep -Po '/dev/[^|]+' <<<"$all" | cut -c 6-))
fi
-# local disk_names
-# disk_names=(`sed -e 's/||/\n/g;s/^|//' <<< "$all" | cut -d '|' -f2 | tr ' ' '_'`)
+ # local disk_names
+ # disk_names=(`sed -e 's/||/\n/g;s/^|//' <<< "$all" | cut -d '|' -f2 | tr ' ' '_'`)
echo "CHART hddtemp.temperature 'disks_temp' 'temperature' 'Celsius' 'Disks temperature' 'hddtemp.temp' line $((hddtemp_priority)) $hddtemp_update_every"
- for i in $(seq 0 $((${#hddtemp_disks[@]}-1))); do
-# echo "DIMENSION ${hddtemp_disks[i]} ${disk_names[i]} absolute 1 1"
+ for i in $(seq 0 $((${#hddtemp_disks[@]} - 1))); do
+ # echo "DIMENSION ${hddtemp_disks[i]} ${disk_names[i]} absolute 1 1"
echo "DIMENSION ${hddtemp_disks[$i]} '' absolute 1 1"
done
return 0
@@ -49,12 +49,12 @@ hddtemp_create() {
#hddtemp_last=0
#hddtemp_count=0
hddtemp_update() {
-# local all=( `nc $hddtemp_host $hddtemp_port | sed -e 's/||/\n/g;s/^|//' | cut -d '|' -f3` )
-# local all=( `nc $hddtemp_host $hddtemp_port | awk 'BEGIN { FS="|" };{i=4; while (i <= NF) {print $i+0;i+=5;};}'` )
+ # local all=( `nc $hddtemp_host $hddtemp_port | sed -e 's/||/\n/g;s/^|//' | cut -d '|' -f3` )
+ # local all=( `nc $hddtemp_host $hddtemp_port | awk 'BEGIN { FS="|" };{i=4; while (i <= NF) {print $i+0;i+=5;};}'` )
OLD_IFS=$IFS
set -f
# shellcheck disable=SC2207
- IFS="|" all=( $(nc $hddtemp_host $hddtemp_port 2>/dev/null) )
+ IFS="|" all=($(nc $hddtemp_host $hddtemp_port 2>/dev/null))
set +f
IFS=$OLD_IFS
@@ -66,9 +66,9 @@ hddtemp_update() {
# write the result of the work.
echo "BEGIN hddtemp.temperature $1"
end=${#hddtemp_disks[@]}
- for ((i=0; i<end; i++)); do
+ for ((i = 0; i < end; i++)); do
# temperature - this will turn SLP to zero
- t=$(( ${all[ $((i * 5 + 3)) ]} ))
+ t=$((all[$((i * 5 + 3))]))
echo "SET ${hddtemp_disks[$i]} = $t"
done
echo "END"
diff --git a/collectors/charts.d.plugin/libreswan/README.md b/collectors/charts.d.plugin/libreswan/README.md
index 41026cf7..18c64507 100644
--- a/collectors/charts.d.plugin/libreswan/README.md
+++ b/collectors/charts.d.plugin/libreswan/README.md
@@ -40,3 +40,5 @@ netdata ALL = (root) NOPASSWD: /sbin/ipsec whack --trafficstatus
Make sure the path `/sbin/ipsec` matches your setup (execute `which ipsec` to find the right path).
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Flibreswan%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/libreswan/libreswan.chart.sh b/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
index 6e29f847..1a8f90b1 100644
--- a/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
+++ b/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
@@ -39,8 +39,7 @@ declare -A libreswan_tunnel_charts=()
# run the ipsec command
libreswan_ipsec() {
- if [ ${libreswan_sudo} -ne 0 ]
- then
+ if [ ${libreswan_sudo} -ne 0 ]; then
sudo -n "${IPSEC_CMD}" "${@}"
return $?
else
@@ -61,15 +60,15 @@ libreswan_get() {
libreswan_connected_tunnels=()
# convert the ipsec command output to a shell script
- # and source it to get the values
- # shellcheck disable=SC1090
+ # and source it to get the values
+ # shellcheck disable=SC1090
source <(
{
- libreswan_ipsec whack --status;
- libreswan_ipsec whack --trafficstatus;
+ libreswan_ipsec whack --status
+ libreswan_ipsec whack --trafficstatus
} | sed -n \
- -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\".*IPsec SA established.*newest IPSEC.*|libreswan_connected_tunnels[\"\1\"]=\"\2\"|p" \
- -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\",.* add_time=\([0-9]\+\),.* inBytes=\([0-9]\+\),.* outBytes=\([0-9]\+\).*|libreswan_traffic_in[\"\1\"]=\"\4\"; libreswan_traffic_out[\"\1\"]=\"\5\"; libreswan_established_add_time[\"\1\"]=\"\3\";|p"
+ -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\".*IPsec SA established.*newest IPSEC.*|libreswan_connected_tunnels[\"\1\"]=\"\2\"|p" \
+ -e "s|[0-9]\+ #\([0-9]\+\): \"\(.*\)\",.* add_time=\([0-9]\+\),.* inBytes=\([0-9]\+\),.* outBytes=\([0-9]\+\).*|libreswan_traffic_in[\"\1\"]=\"\4\"; libreswan_traffic_out[\"\1\"]=\"\5\"; libreswan_established_add_time[\"\1\"]=\"\3\";|p"
) || return 1
# check we got some data
@@ -88,10 +87,9 @@ libreswan_check() {
# make sure it is libreswan
# shellcheck disable=SC2143
- if [ -z "$(ipsec --version | grep -i libreswan)" ]
- then
- error "ipsec command is not Libreswan. Disabling Libreswan plugin."
- return 1
+ if [ -z "$(ipsec --version | grep -i libreswan)" ]; then
+ error "ipsec command is not Libreswan. Disabling Libreswan plugin."
+ return 1
fi
# check that we can collect data
@@ -125,8 +123,7 @@ EOF
# _create is called once, to create the charts
libreswan_create() {
local n
- for n in "${!libreswan_connected_tunnels[@]}"
- do
+ for n in "${!libreswan_connected_tunnels[@]}"; do
libreswan_create_one "${n}"
done
return 0
@@ -143,10 +140,10 @@ libreswan_update_one() {
[ -z "${id}" ] && libreswan_create_one "${name}"
- uptime=$(( libreswan_now - libreswan_established_add_time[${n}] ))
+ uptime=$((libreswan_now - libreswan_established_add_time[${n}]))
[ ${uptime} -lt 0 ] && uptime=0
- # write the result of the work.
+ # write the result of the work.
cat <<VALUESEOF
BEGIN libreswan.${id}_net ${microseconds}
SET in = ${libreswan_traffic_in[${n}]}
@@ -167,8 +164,7 @@ libreswan_update() {
libreswan_now=$(date +%s)
local n
- for n in "${!libreswan_connected_tunnels[@]}"
- do
+ for n in "${!libreswan_connected_tunnels[@]}"; do
libreswan_update_one "${n}" "${@}"
done
diff --git a/collectors/charts.d.plugin/load_average/README.md b/collectors/charts.d.plugin/load_average/README.md
index 39d3b818..ef84b5bd 100644
--- a/collectors/charts.d.plugin/load_average/README.md
+++ b/collectors/charts.d.plugin/load_average/README.md
@@ -1,2 +1,6 @@
+# load_average
+
> THIS MODULE IS OBSOLETE.
> THE NETDATA DAEMON COLLECTS LOAD AVERAGE BY ITSELF
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fload_average%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/load_average/load_average.chart.sh b/collectors/charts.d.plugin/load_average/load_average.chart.sh
index b30cb850..841e3d9f 100644
--- a/collectors/charts.d.plugin/load_average/load_average.chart.sh
+++ b/collectors/charts.d.plugin/load_average/load_average.chart.sh
@@ -21,8 +21,7 @@ load_average_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- if [ ${load_average_update_every} -lt 5 ]
- then
+ if [ ${load_average_update_every} -lt 5 ]; then
# there is no meaning for shorter than 5 seconds
# the kernel changes this value every 5 seconds
load_average_update_every=5
@@ -34,7 +33,7 @@ load_average_check() {
load_average_create() {
# create a chart with 3 dimensions
-cat <<EOF
+ cat <<EOF
CHART system.load '' "System Load Average" "load" load system.load line $((load_priority + 1)) $load_average_update_every
DIMENSION load1 '1 min' absolute 1 100
DIMENSION load5 '5 mins' absolute 1 100
@@ -52,10 +51,10 @@ load_average_update() {
# here we parse the system average load
# it is decimal (with 2 decimal digits), so we remove the dot and
# at the definition we have divisor = 100, to have the graph show the right value
- loadavg="`cat /proc/loadavg | sed -e "s/\.//g"`"
- load1=`echo $loadavg | cut -d ' ' -f 1`
- load5=`echo $loadavg | cut -d ' ' -f 2`
- load15=`echo $loadavg | cut -d ' ' -f 3`
+ loadavg="$(cat /proc/loadavg | sed -e "s/\.//g")"
+ load1=$(echo $loadavg | cut -d ' ' -f 1)
+ load5=$(echo $loadavg | cut -d ' ' -f 2)
+ load15=$(echo $loadavg | cut -d ' ' -f 3)
# write the result of the work.
cat <<VALUESEOF
@@ -68,4 +67,3 @@ VALUESEOF
return 0
}
-
diff --git a/collectors/charts.d.plugin/loopsleepms.sh.inc b/collectors/charts.d.plugin/loopsleepms.sh.inc
index bdc032b9..e44eff68 100644
--- a/collectors/charts.d.plugin/loopsleepms.sh.inc
+++ b/collectors/charts.d.plugin/loopsleepms.sh.inc
@@ -2,10 +2,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
LOOPSLEEP_DATE="$(which date 2>/dev/null || command -v date 2>/dev/null)"
-if [ -z "$LOOPSLEEP_DATE" ]
- then
- echo >&2 "$0: ERROR: Cannot find the command 'date' in the system path."
- exit 1
+if [ -z "$LOOPSLEEP_DATE" ]; then
+ echo >&2 "$0: ERROR: Cannot find the command 'date' in the system path."
+ exit 1
fi
# -----------------------------------------------------------------------------
@@ -14,14 +13,13 @@ fi
now_ms=
LOOPSLEEPMS_HIGHRES=1
test "$($LOOPSLEEP_DATE +%N)" = "%N" && LOOPSLEEPMS_HIGHRES=0
-test -z "$($LOOPSLEEP_DATE +%N)" && LOOPSLEEPMS_HIGHRES=0
+test -z "$($LOOPSLEEP_DATE +%N)" && LOOPSLEEPMS_HIGHRES=0
current_time_ms_from_date() {
- if [ $LOOPSLEEPMS_HIGHRES -eq 0 ]
- then
- now_ms="$($LOOPSLEEP_DATE +'%s')000"
- else
- now_ms="$(( $( $LOOPSLEEP_DATE +'%s * 1000 + %-N / 1000000' ) ))"
- fi
+ if [ $LOOPSLEEPMS_HIGHRES -eq 0 ]; then
+ now_ms="$($LOOPSLEEP_DATE +'%s')000"
+ else
+ now_ms="$(($($LOOPSLEEP_DATE +'%s * 1000 + %-N / 1000000')))"
+ fi
}
# -----------------------------------------------------------------------------
@@ -32,55 +30,49 @@ current_time_ms_from_uptime_started="${now_ms}"
current_time_ms_from_uptime_last="${now_ms}"
current_time_ms_from_uptime_first=0
current_time_ms_from_uptime() {
- local up rest arr=() n
-
- read up rest </proc/uptime
- if [ $? -ne 0 ]
- then
- echo >&2 "$0: Cannot read /proc/uptime - falling back to current_time_ms_from_date()."
- current_time_ms="current_time_ms_from_date"
- current_time_ms_from_date
- current_time_ms_accuracy=1
- return
- fi
-
- arr=(${up//./ })
-
- if [ ${#arr[1]} -lt 1 ]
- then
- n="${arr[0]}000"
- elif [ ${#arr[1]} -lt 2 ]
- then
- n="${arr[0]}${arr[1]}00"
- elif [ ${#arr[1]} -lt 3 ]
- then
- n="${arr[0]}${arr[1]}0"
- else
- n="${arr[0]}${arr[1]}"
- fi
-
- now_ms=$((current_time_ms_from_uptime_started - current_time_ms_from_uptime_first + n))
-
- if [ "${now_ms}" -lt "${current_time_ms_from_uptime_last}" ]
- then
- echo >&2 "$0: Cannot use current_time_ms_from_uptime() - new time ${now_ms} is older than the last ${current_time_ms_from_uptime_last} - falling back to current_time_ms_from_date()."
- current_time_ms="current_time_ms_from_date"
- current_time_ms_from_date
- current_time_ms_accuracy=1
- fi
-
- current_time_ms_from_uptime_last="${now_ms}"
+ local up rest arr=() n
+
+ read up rest </proc/uptime
+ if [ $? -ne 0 ]; then
+ echo >&2 "$0: Cannot read /proc/uptime - falling back to current_time_ms_from_date()."
+ current_time_ms="current_time_ms_from_date"
+ current_time_ms_from_date
+ current_time_ms_accuracy=1
+ return
+ fi
+
+ arr=(${up//./ })
+
+ if [ ${#arr[1]} -lt 1 ]; then
+ n="${arr[0]}000"
+ elif [ ${#arr[1]} -lt 2 ]; then
+ n="${arr[0]}${arr[1]}00"
+ elif [ ${#arr[1]} -lt 3 ]; then
+ n="${arr[0]}${arr[1]}0"
+ else
+ n="${arr[0]}${arr[1]}"
+ fi
+
+ now_ms=$((current_time_ms_from_uptime_started - current_time_ms_from_uptime_first + n))
+
+ if [ "${now_ms}" -lt "${current_time_ms_from_uptime_last}" ]; then
+ echo >&2 "$0: Cannot use current_time_ms_from_uptime() - new time ${now_ms} is older than the last ${current_time_ms_from_uptime_last} - falling back to current_time_ms_from_date()."
+ current_time_ms="current_time_ms_from_date"
+ current_time_ms_from_date
+ current_time_ms_accuracy=1
+ fi
+
+ current_time_ms_from_uptime_last="${now_ms}"
}
current_time_ms_from_uptime
current_time_ms_from_uptime_first="$((now_ms - current_time_ms_from_uptime_started))"
current_time_ms_from_uptime_last="${current_time_ms_from_uptime_first}"
current_time_ms="current_time_ms_from_uptime"
current_time_ms_accuracy=10
-if [ "${current_time_ms_from_uptime_first}" -eq 0 ]
- then
- echo >&2 "$0: Invalid setup for current_time_ms_from_uptime() - falling back to current_time_ms_from_date()."
- current_time_ms="current_time_ms_from_date"
- current_time_ms_accuracy=1
+if [ "${current_time_ms_from_uptime_first}" -eq 0 ]; then
+ echo >&2 "$0: Invalid setup for current_time_ms_from_uptime() - falling back to current_time_ms_from_date()."
+ current_time_ms="current_time_ms_from_date"
+ current_time_ms_accuracy=1
fi
# -----------------------------------------------------------------------------
@@ -94,55 +86,48 @@ mysleep_fifo="${NETDATA_CACHE_DIR-/tmp}/.netdata_bash_sleep_timer_fifo"
[ -p "${mysleep_fifo}" ] && mysleep="mysleep_read"
mysleep_read() {
- read -t "${1}" <>"${mysleep_fifo}"
- ret=$?
- if [ $ret -le 128 ]
- then
- echo >&2 "$0: Cannot use read for sleeping (return code ${ret})."
- mysleep="sleep"
- ${mysleep} "${1}"
- fi
+ read -t "${1}" <>"${mysleep_fifo}"
+ ret=$?
+ if [ $ret -le 128 ]; then
+ echo >&2 "$0: Cannot use read for sleeping (return code ${ret})."
+ mysleep="sleep"
+ ${mysleep} "${1}"
+ fi
}
# -----------------------------------------------------------------------------
# use bash loadable module for sleep
mysleep_builtin() {
- builtin sleep "${1}"
- ret=$?
- if [ $ret -ne 0 ]
- then
- echo >&2 "$0: Cannot use builtin sleep for sleeping (return code ${ret})."
- mysleep="sleep"
- ${mysleep} "${1}"
- fi
+ builtin sleep "${1}"
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo >&2 "$0: Cannot use builtin sleep for sleeping (return code ${ret})."
+ mysleep="sleep"
+ ${mysleep} "${1}"
+ fi
}
-if [ -z "${mysleep}" -a "$((BASH_VERSINFO[0] +0))" -ge 3 -a "${NETDATA_BASH_LOADABLES}" != "DISABLE" ]
- then
- # enable modules only for bash version 3+
-
- for bash_modules_path in ${BASH_LOADABLES_PATH//:/ } "$(pkg-config bash --variable=loadablesdir 2>/dev/null)" "/usr/lib/bash" "/lib/bash" "/lib64/bash" "/usr/local/lib/bash" "/usr/local/lib64/bash"
- do
- [ -z "${bash_modules_path}" -o ! -d "${bash_modules_path}" ] && continue
-
- # check for sleep
- for bash_module_sleep in "sleep" "sleep.so"
- do
- if [ -f "${bash_modules_path}/${bash_module_sleep}" ]
- then
- if enable -f "${bash_modules_path}/${bash_module_sleep}" sleep 2>/dev/null
- then
- mysleep="mysleep_builtin"
- # echo >&2 "$0: Using bash loadable ${bash_modules_path}/${bash_module_sleep} for sleep"
- break
- fi
- fi
-
- done
-
- [ ! -z "${mysleep}" ] && break
- done
+if [ -z "${mysleep}" -a "$((BASH_VERSINFO[0] + 0))" -ge 3 -a "${NETDATA_BASH_LOADABLES}" != "DISABLE" ]; then
+ # enable modules only for bash version 3+
+
+ for bash_modules_path in ${BASH_LOADABLES_PATH//:/ } "$(pkg-config bash --variable=loadablesdir 2>/dev/null)" "/usr/lib/bash" "/lib/bash" "/lib64/bash" "/usr/local/lib/bash" "/usr/local/lib64/bash"; do
+ [ -z "${bash_modules_path}" -o ! -d "${bash_modules_path}" ] && continue
+
+ # check for sleep
+ for bash_module_sleep in "sleep" "sleep.so"; do
+ if [ -f "${bash_modules_path}/${bash_module_sleep}" ]; then
+ if enable -f "${bash_modules_path}/${bash_module_sleep}" sleep 2>/dev/null; then
+ mysleep="mysleep_builtin"
+ # echo >&2 "$0: Using bash loadable ${bash_modules_path}/${bash_module_sleep} for sleep"
+ break
+ fi
+ fi
+
+ done
+
+ [ ! -z "${mysleep}" ] && break
+ done
fi
# -----------------------------------------------------------------------------
@@ -150,7 +135,6 @@ fi
[ -z "${mysleep}" ] && mysleep="sleep"
-
# -----------------------------------------------------------------------------
# this function is used to sleep a fraction of a second
# it calculates the difference between every time is called
@@ -163,60 +147,58 @@ LOOPSLEEPMS_LASTSLEEP=0
LOOPSLEEPMS_LASTWORK=0
loopsleepms() {
- local tellwork=0 t="${1}" div s m now mstosleep
-
- if [ "${t}" = "tellwork" ]
- then
- tellwork=1
- shift
- t="${1}"
- fi
-
- # $t = the time in seconds to wait
-
- # if high resolution is not supported
- # just sleep the time requested, in seconds
- if [ ${LOOPSLEEPMS_HIGHRES} -eq 0 ]
- then
- sleep ${t}
- return
- fi
-
- # get the current time, in ms in ${now_ms}
- ${current_time_ms}
-
- # calculate ms since last run
- [ ${LOOPSLEEPMS_LASTRUN} -gt 0 ] && \
- LOOPSLEEPMS_LASTWORK=$((now_ms - LOOPSLEEPMS_LASTRUN - LOOPSLEEPMS_LASTSLEEP + current_time_ms_accuracy))
- # echo "# last loop's work took $LOOPSLEEPMS_LASTWORK ms"
-
- # remember this run
- LOOPSLEEPMS_LASTRUN=${now_ms}
-
- # calculate the next run
- LOOPSLEEPMS_NEXTRUN=$(( ( now_ms - ( now_ms % ( t * 1000 ) ) ) + ( t * 1000 ) ))
-
- # calculate ms to sleep
- mstosleep=$(( LOOPSLEEPMS_NEXTRUN - now_ms + current_time_ms_accuracy ))
- # echo "# mstosleep is $mstosleep ms"
-
- # if we are too slow, sleep some time
- test ${mstosleep} -lt 200 && mstosleep=200
-
- s=$(( mstosleep / 1000 ))
- m=$(( mstosleep - (s * 1000) ))
- [ "${m}" -lt 100 ] && m="0${m}"
- [ "${m}" -lt 10 ] && m="0${m}"
-
- test $tellwork -eq 1 && echo >&2 " >>> PERFORMANCE >>> WORK TOOK ${LOOPSLEEPMS_LASTWORK} ms ( $((LOOPSLEEPMS_LASTWORK * 100 / 1000)).$((LOOPSLEEPMS_LASTWORK % 10))% cpu ) >>> SLEEPING ${mstosleep} ms"
-
- # echo "# sleeping ${s}.${m}"
- # echo
- ${mysleep} ${s}.${m}
-
- # keep the values we need
- # for our next run
- LOOPSLEEPMS_LASTSLEEP=$mstosleep
+ local tellwork=0 t="${1}" div s m now mstosleep
+
+ if [ "${t}" = "tellwork" ]; then
+ tellwork=1
+ shift
+ t="${1}"
+ fi
+
+ # $t = the time in seconds to wait
+
+ # if high resolution is not supported
+ # just sleep the time requested, in seconds
+ if [ ${LOOPSLEEPMS_HIGHRES} -eq 0 ]; then
+ sleep ${t}
+ return
+ fi
+
+ # get the current time, in ms in ${now_ms}
+ ${current_time_ms}
+
+ # calculate ms since last run
+ [ ${LOOPSLEEPMS_LASTRUN} -gt 0 ] &&
+ LOOPSLEEPMS_LASTWORK=$((now_ms - LOOPSLEEPMS_LASTRUN - LOOPSLEEPMS_LASTSLEEP + current_time_ms_accuracy))
+ # echo "# last loop's work took $LOOPSLEEPMS_LASTWORK ms"
+
+ # remember this run
+ LOOPSLEEPMS_LASTRUN=${now_ms}
+
+ # calculate the next run
+ LOOPSLEEPMS_NEXTRUN=$(((now_ms - (now_ms % (t * 1000))) + (t * 1000)))
+
+ # calculate ms to sleep
+ mstosleep=$((LOOPSLEEPMS_NEXTRUN - now_ms + current_time_ms_accuracy))
+ # echo "# mstosleep is $mstosleep ms"
+
+ # if we are too slow, sleep some time
+ test ${mstosleep} -lt 200 && mstosleep=200
+
+ s=$((mstosleep / 1000))
+ m=$((mstosleep - (s * 1000)))
+ [ "${m}" -lt 100 ] && m="0${m}"
+ [ "${m}" -lt 10 ] && m="0${m}"
+
+ test $tellwork -eq 1 && echo >&2 " >>> PERFORMANCE >>> WORK TOOK ${LOOPSLEEPMS_LASTWORK} ms ( $((LOOPSLEEPMS_LASTWORK * 100 / 1000)).$((LOOPSLEEPMS_LASTWORK % 10))% cpu ) >>> SLEEPING ${mstosleep} ms"
+
+ # echo "# sleeping ${s}.${m}"
+ # echo
+ ${mysleep} ${s}.${m}
+
+ # keep the values we need
+ # for our next run
+ LOOPSLEEPMS_LASTSLEEP=$mstosleep
}
# test it
diff --git a/collectors/charts.d.plugin/mem_apps/README.md b/collectors/charts.d.plugin/mem_apps/README.md
index cd8adf0a..a9513e9f 100644
--- a/collectors/charts.d.plugin/mem_apps/README.md
+++ b/collectors/charts.d.plugin/mem_apps/README.md
@@ -1,2 +1,6 @@
+# mem_apps
+
> THIS MODULE IS OBSOLETE.
-> USE APPS.PLUGIN.
+> USE [APPS.PLUGIN](../../apps.plugin).
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fmem_apps%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh b/collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh
index a13dc71f..b9b84a46 100644
--- a/collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh
+++ b/collectors/charts.d.plugin/mem_apps/mem_apps.chart.sh
@@ -20,8 +20,7 @@ mem_apps_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- if [ -z "$mem_apps_apps" ]
- then
+ if [ -z "$mem_apps_apps" ]; then
error "manual configuration required: please set mem_apps_apps='command1 command2 ...' in $confd/mem_apps_apps.conf"
return 1
fi
@@ -35,8 +34,7 @@ mem_apps_create() {
echo "CHART chartsd_apps.mem '' 'Apps Memory' MB apps apps.mem stacked 20000 $mem_apps_update_every"
local x=
- for x in $mem_apps_apps
- do
+ for x in $mem_apps_apps; do
echo "DIMENSION $x $x absolute 1 1024"
# this string is needed later in the update() function
@@ -52,9 +50,10 @@ mem_apps_update() {
# remember: KEEP IT SIMPLE AND SHORT
echo "BEGIN chartsd_apps.mem"
- ps -o comm,rss -C "$mem_apps_apps" |\
- grep -v "^COMMAND" |\
- ( sed -e "s/ \+/ /g" -e "s/ /+=/g";
+ ps -o comm,rss -C "$mem_apps_apps" |
+ grep -v "^COMMAND" |
+ (
+ sed -e "s/ \+/ /g" -e "s/ /+=/g"
echo "$mem_apps_bc_finalze"
) | bc
echo "END"
diff --git a/collectors/charts.d.plugin/mysql/README.md b/collectors/charts.d.plugin/mysql/README.md
index 6765b53a..e52449a4 100644
--- a/collectors/charts.d.plugin/mysql/README.md
+++ b/collectors/charts.d.plugin/mysql/README.md
@@ -1,8 +1,8 @@
-> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
-
# mysql
+> THIS MODULE IS OBSOLETE.
+> USE [THE PYTHON ONE](../../python.d.plugin/mysql) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
The plugin will monitor one or more mysql servers
It will produce the following charts:
@@ -79,3 +79,5 @@ If no configuration is given, the plugin will attempt to connect to mysql server
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fmysql%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/mysql/mysql.chart.sh b/collectors/charts.d.plugin/mysql/mysql.chart.sh
index 37e8e2a7..e1207dc9 100644
--- a/collectors/charts.d.plugin/mysql/mysql.chart.sh
+++ b/collectors/charts.d.plugin/mysql/mysql.chart.sh
@@ -27,19 +27,19 @@ mysql_get() {
#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]" ))
# shellcheck disable=SC2207
- arr=($(run "${@}" -N -e "SHOW GLOBAL STATUS;" | grep -E "^(Bytes|Slow_|Que|Handl|Table|Selec|Sort_|Creat|Conne|Abort|Binlo|Threa|Innod|Qcach|Key_|Open)[^[:space:]]+[[:space:]]+[0-9]+" ))
+ arr=($(run "${@}" -N -e "SHOW GLOBAL STATUS;" | grep -E "^(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
local end=${#arr[@]}
- for ((i=2;i<end;i+=2)); do
- mysql_data["${arr[$i]}"]=${arr[$i+1]}
+ for ((i = 2; i < end; i += 2)); do
+ mysql_data["${arr[$i]}"]=${arr[i + 1]}
done
[ -z "${mysql_data[Connections]}" ] && return 1
mysql_data[Thread_cache_misses]=0
- [ $(( mysql_data[Connections] + 1 - 1 )) -gt 0 ] && mysql_data[Thread_cache_misses]=$(( mysql_data[Threads_created] * 10000 / mysql_data[Connections] ))
+ [ $((mysql_data[Connections] + 1 - 1)) -gt 0 ] && mysql_data[Thread_cache_misses]=$((mysql_data[Threads_created] * 10000 / mysql_data[Connections]))
return 0
}
@@ -51,23 +51,20 @@ mysql_check() {
local x m mysql_cmd tryroot=0 unconfigured=0
- if [ "${1}" = "tryroot" ]
- then
+ if [ "${1}" = "tryroot" ]; then
tryroot=1
shift
fi
- # shellcheck disable=SC2230
+ # shellcheck disable=SC2230
[ -z "${mysql_cmd}" ] && mysql_cmd="$(which mysql 2>/dev/null || command -v mysql 2>/dev/null)"
- if [ ${#mysql_opts[@]} -eq 0 ]
- then
+ if [ ${#mysql_opts[@]} -eq 0 ]; then
unconfigured=1
mysql_cmds[local]="$mysql_cmd"
- if [ $tryroot -eq 1 ]
- then
+ if [ $tryroot -eq 1 ]; then
# the user has not configured us for mysql access
# if the root user is passwordless in mysql, we can
# attempt to connect to mysql as root
@@ -78,19 +75,16 @@ mysql_check() {
fi
# check once if the url works
- for m in "${!mysql_opts[@]}"
- do
+ for m in "${!mysql_opts[@]}"; do
[ -z "${mysql_cmds[$m]}" ] && mysql_cmds[$m]="$mysql_cmd"
- if [ -z "${mysql_cmds[$m]}" ]
- then
+ if [ -z "${mysql_cmds[$m]}" ]; then
# shellcheck disable=SC2154
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]}
# shellcheck disable=SC2181
- if [ ! $? -eq 0 ]
- then
+ if [ ! $? -eq 0 ]; then
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]"
@@ -98,13 +92,11 @@ mysql_check() {
continue
fi
- mysql_ids[$m]="$( fixid "$m" )"
+ mysql_ids[$m]="$(fixid "$m")"
done
- if [ ${#mysql_opts[@]} -eq 0 ]
- then
- if [ ${unconfigured} -eq 1 ] && [ ${tryroot} -eq 0 ]
- then
+ if [ ${#mysql_opts[@]} -eq 0 ]; then
+ if [ ${unconfigured} -eq 1 ] && [ ${tryroot} -eq 0 ]; then
mysql_check tryroot "${@}"
return $?
else
@@ -120,8 +112,7 @@ mysql_create() {
local x
# create the charts
- for x in "${mysql_ids[@]}"
- do
+ for x in "${mysql_ids[@]}"; do
cat <<EOF
CHART mysql_$x.net '' "mysql Bandwidth" "kilobits/s" bandwidth mysql.net area $((mysql_priority + 1)) $mysql_update_every
DIMENSION Bytes_received in incremental 8 1024
@@ -230,7 +221,7 @@ DIMENSION Innodb_buffer_pool_pages_flushed flushed incremental -1 1
DIMENSION Innodb_buffer_pool_pages_misc misc absolute -1 1
DIMENSION Innodb_buffer_pool_pages_total total absolute 1 1
-CHART mysql_$x.innodb_buffer_pool_bytes '' "mysql InnoDB Buffer Pool Bytes" "MB" innodb mysql.innodb_buffer_pool_bytes area $((mysql_priority + 21)) $mysql_update_every
+CHART mysql_$x.innodb_buffer_pool_bytes '' "mysql InnoDB Buffer Pool Bytes" "MiB" innodb mysql.innodb_buffer_pool_bytes area $((mysql_priority + 21)) $mysql_update_every
DIMENSION Innodb_buffer_pool_bytes_data data absolute 1 $((1024 * 1024))
DIMENSION Innodb_buffer_pool_bytes_dirty dirty absolute -1 $((1024 * 1024))
@@ -256,7 +247,7 @@ DIMENSION Qcache_not_cached 'not cached' incremental -1 1
CHART mysql_$x.qcache '' "mysql QCache Queries in Cache" "queries" qcache mysql.qcache line $((mysql_priority + 26)) $mysql_update_every
DIMENSION Qcache_queries_in_cache queries absolute 1 1
-CHART mysql_$x.qcache_freemem '' "mysql QCache Free Memory" "MB" qcache mysql.qcache_freemem area $((mysql_priority + 27)) $mysql_update_every
+CHART mysql_$x.qcache_freemem '' "mysql QCache Free Memory" "MiB" qcache mysql.qcache_freemem area $((mysql_priority + 27)) $mysql_update_every
DIMENSION Qcache_free_memory free absolute 1 $((1024 * 1024))
CHART mysql_$x.qcache_memblocks '' "mysql QCache Memory Blocks" "blocks" qcache mysql.qcache_memblocks line $((mysql_priority + 28)) $mysql_update_every
@@ -283,18 +274,16 @@ CHART mysql_$x.files_rate '' "mysql Opened Files Rate" "files/s" files mysql.fil
DIMENSION Opened_files files incremental 1 1
EOF
- if [ ! -z "${mysql_data[Binlog_stmt_cache_disk_use]}" ]
- then
- cat <<EOF
+ if [ ! -z "${mysql_data[Binlog_stmt_cache_disk_use]}" ]; then
+ cat <<EOF
CHART mysql_$x.binlog_stmt_cache '' "mysql Binlog Statement Cache" "statements/s" binlog mysql.binlog_stmt_cache line $((mysql_priority + 50)) $mysql_update_every
DIMENSION Binlog_stmt_cache_disk_use disk incremental 1 1
DIMENSION Binlog_stmt_cache_use all incremental 1 1
EOF
- fi
+ fi
- if [ ! -z "${mysql_data[Connection_errors_accept]}" ]
- then
- cat <<EOF
+ if [ ! -z "${mysql_data[Connection_errors_accept]}" ]; then
+ cat <<EOF
CHART mysql_$x.connection_errors '' "mysql Connection Errors" "connections/s" connections mysql.connection_errors line $((mysql_priority + 51)) $mysql_update_every
DIMENSION Connection_errors_accept accept incremental 1 1
DIMENSION Connection_errors_internal internal incremental 1 1
@@ -303,13 +292,12 @@ DIMENSION Connection_errors_peer_addr peer_addr incremental 1 1
DIMENSION Connection_errors_select select incremental 1 1
DIMENSION Connection_errors_tcpwrap tcpwrap incremental 1 1
EOF
- fi
+ fi
done
return 0
}
-
mysql_update() {
# the first argument to this function is the microseconds since last update
# pass this parameter to the BEGIN statement (see bellow).
@@ -319,14 +307,12 @@ mysql_update() {
# remember: KEEP IT SIMPLE AND SHORT
local m x
- for m in "${!mysql_ids[@]}"
- do
+ for m in "${!mysql_ids[@]}"; do
x="${mysql_ids[$m]}"
mysql_get "${mysql_cmds[$m]}" ${mysql_opts[$m]}
# shellcheck disable=SC2181
- if [ $? -ne 0 ]
- then
+ if [ $? -ne 0 ]; then
unset "mysql_ids[$m]"
unset "mysql_opts[$m]"
unset "mysql_cmds[$m]"
@@ -497,8 +483,7 @@ SET Opened_files = ${mysql_data[Opened_files]}
END
VALUESEOF
- if [ ! -z "${mysql_data[Binlog_stmt_cache_disk_use]}" ]
- then
+ if [ ! -z "${mysql_data[Binlog_stmt_cache_disk_use]}" ]; then
cat <<VALUESEOF
BEGIN mysql_$x.binlog_stmt_cache $1
SET Binlog_stmt_cache_disk_use = ${mysql_data[Binlog_stmt_cache_disk_use]}
@@ -507,8 +492,7 @@ END
VALUESEOF
fi
- if [ ! -z "${mysql_data[Connection_errors_accept]}" ]
- then
+ if [ ! -z "${mysql_data[Connection_errors_accept]}" ]; then
cat <<VALUESEOF
BEGIN mysql_$x.connection_errors $1
SET Connection_errors_accept = ${mysql_data[Connection_errors_accept]}
@@ -525,4 +509,3 @@ VALUESEOF
[ ${#mysql_ids[@]} -eq 0 ] && error "no mysql servers left active." && return 1
return 0
}
-
diff --git a/collectors/charts.d.plugin/nginx/README.md b/collectors/charts.d.plugin/nginx/README.md
index d82951aa..42a4f812 100644
--- a/collectors/charts.d.plugin/nginx/README.md
+++ b/collectors/charts.d.plugin/nginx/README.md
@@ -1,2 +1,6 @@
+# nginx
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/nginx) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fnginx%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/nginx/nginx.chart.sh b/collectors/charts.d.plugin/nginx/nginx.chart.sh
index 14dda083..812de2cb 100644
--- a/collectors/charts.d.plugin/nginx/nginx.chart.sh
+++ b/collectors/charts.d.plugin/nginx/nginx.chart.sh
@@ -32,16 +32,15 @@ nginx_get() {
# shellcheck disable=SC2181
if [ $? -ne 0 ] || [ "${#nginx_response[@]}" -eq 0 ]; then return 1; fi
- if [ "${nginx_response[0]}" != "Active" ] ||\
- [ "${nginx_response[1]}" != "connections:" ] ||\
- [ "${nginx_response[3]}" != "server" ] ||\
- [ "${nginx_response[4]}" != "accepts" ] ||\
- [ "${nginx_response[5]}" != "handled" ] ||\
- [ "${nginx_response[6]}" != "requests" ] ||\
- [ "${nginx_response[10]}" != "Reading:" ] ||\
- [ "${nginx_response[12]}" != "Writing:" ] ||\
- [ "${nginx_response[14]}" != "Waiting:" ]
- then
+ if [ "${nginx_response[0]}" != "Active" ] ||
+ [ "${nginx_response[1]}" != "connections:" ] ||
+ [ "${nginx_response[3]}" != "server" ] ||
+ [ "${nginx_response[4]}" != "accepts" ] ||
+ [ "${nginx_response[5]}" != "handled" ] ||
+ [ "${nginx_response[6]}" != "requests" ] ||
+ [ "${nginx_response[10]}" != "Reading:" ] ||
+ [ "${nginx_response[12]}" != "Writing:" ] ||
+ [ "${nginx_response[14]}" != "Waiting:" ]; then
error "Invalid response from nginx server: ${nginx_response[*]}"
return 1
fi
@@ -54,14 +53,13 @@ nginx_get() {
nginx_writing="${nginx_response[13]}"
nginx_waiting="${nginx_response[15]}"
- if [ -z "${nginx_active_connections}" ] ||\
- [ -z "${nginx_accepts}" ] ||\
- [ -z "${nginx_handled}" ] ||\
- [ -z "${nginx_requests}" ] ||\
- [ -z "${nginx_reading}" ] ||\
- [ -z "${nginx_writing}" ] ||\
- [ -z "${nginx_waiting}" ]
- then
+ if [ -z "${nginx_active_connections}" ] ||
+ [ -z "${nginx_accepts}" ] ||
+ [ -z "${nginx_handled}" ] ||
+ [ -z "${nginx_requests}" ] ||
+ [ -z "${nginx_reading}" ] ||
+ [ -z "${nginx_writing}" ] ||
+ [ -z "${nginx_waiting}" ]; then
error "empty values got from nginx server: ${nginx_response[*]}"
return 1
fi
@@ -74,8 +72,7 @@ nginx_check() {
nginx_get
# shellcheck disable=2181
- if [ $? -ne 0 ]
- then
+ if [ $? -ne 0 ]; then
# shellcheck disable=SC2154
error "cannot find stub_status on URL '${nginx_url}'. Please set nginx_url='http://nginx.server/stub_status' in $confd/nginx.conf"
return 1
diff --git a/collectors/charts.d.plugin/nut/README.md b/collectors/charts.d.plugin/nut/README.md
index 71906f55..3e169936 100644
--- a/collectors/charts.d.plugin/nut/README.md
+++ b/collectors/charts.d.plugin/nut/README.md
@@ -57,3 +57,5 @@ nut_update_every=2
```
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fnut%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/nut/nut.chart.sh b/collectors/charts.d.plugin/nut/nut.chart.sh
index 7e252f32..933d3561 100644
--- a/collectors/charts.d.plugin/nut/nut.chart.sh
+++ b/collectors/charts.d.plugin/nut/nut.chart.sh
@@ -34,8 +34,7 @@ nut_get_all() {
nut_get() {
run -t $nut_timeout upsc "$1"
- if [ "${nut_clients_chart}" -eq "1" ]
- then
+ if [ "${nut_clients_chart}" -eq "1" ]; then
printf "ups.connected_clients: "
run -t $nut_timeout upsc -c "$1" | wc -l
fi
@@ -51,27 +50,23 @@ nut_check() {
require_cmd upsc || return 1
- [ -z "$nut_ups" ] && nut_ups="$( nut_get_all )"
+ [ -z "$nut_ups" ] && nut_ups="$(nut_get_all)"
- for x in $nut_ups
- do
+ for x in $nut_ups; do
nut_get "$x" >/dev/null
# shellcheck disable=SC2181
- if [ $? -eq 0 ]
- then
- if [ ! -z "${nut_names[${x}]}" ]
- then
- nut_ids[$x]="$( fixid "${nut_names[${x}]}" )"
+ if [ $? -eq 0 ]; then
+ if [ ! -z "${nut_names[${x}]}" ]; then
+ nut_ids[$x]="$(fixid "${nut_names[${x}]}")"
else
- nut_ids[$x]="$( fixid "$x" )"
+ nut_ids[$x]="$(fixid "$x")"
fi
continue
fi
error "cannot get information for NUT UPS '$x'."
done
- if [ ${#nut_ids[@]} -eq 0 ]
- then
+ if [ ${#nut_ids[@]} -eq 0 ]; then
# shellcheck disable=SC2154
error "Cannot find UPSes - please set nut_ups='ups_name' in $confd/nut.conf"
return 1
@@ -84,8 +79,7 @@ nut_create() {
# create the charts
local x
- for x in "${nut_ids[@]}"
- do
+ for x in "${nut_ids[@]}"; do
cat <<EOF
CHART nut_$x.charge '' "UPS Charge" "percentage" ups nut.charge area $((nut_priority + 1)) $nut_update_every
DIMENSION battery_charge charge absolute 1 100
@@ -121,20 +115,18 @@ CHART nut_$x.temp '' "UPS Temperature" "temperature" ups nut.temperature line $(
DIMENSION temp temp absolute 1 100
EOF
- if [ "${nut_clients_chart}" = "1" ]
- then
- cat <<EOF2
+ if [ "${nut_clients_chart}" = "1" ]; then
+ cat <<EOF2
CHART nut_$x.clients '' "UPS Connected Clients" "clients" ups nut.clients area $((nut_priority + 9)) $nut_update_every
DIMENSION clients '' absolute 1 1
EOF2
- fi
+ fi
done
return 0
}
-
nut_update() {
# the first argument to this function is the microseconds since last update
# pass this parameter to the BEGIN statement (see bellow).
@@ -144,8 +136,7 @@ nut_update() {
# remember: KEEP IT SIMPLE AND SHORT
local i x
- for i in "${!nut_ids[@]}"
- do
+ for i in "${!nut_ids[@]}"; do
x="${nut_ids[$i]}"
nut_get "$i" | awk "
BEGIN {
diff --git a/collectors/charts.d.plugin/opensips/README.md b/collectors/charts.d.plugin/opensips/README.md
index e69de29b..cb056da8 100644
--- a/collectors/charts.d.plugin/opensips/README.md
+++ b/collectors/charts.d.plugin/opensips/README.md
@@ -0,0 +1,7 @@
+# OpenSIPS
+
+*Under construction*
+
+Collects OpenSIPS metrics
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fopensips%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/opensips/opensips.chart.sh b/collectors/charts.d.plugin/opensips/opensips.chart.sh
index c227bd4f..b42462d6 100644
--- a/collectors/charts.d.plugin/opensips/opensips.chart.sh
+++ b/collectors/charts.d.plugin/opensips/opensips.chart.sh
@@ -14,8 +14,8 @@ opensips_timeout=2
opensips_priority=80000
opensips_get_stats() {
- 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:]]*$" |\
+ 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" \
-e "s|[[:space:]:-]\+|_|g" \
@@ -29,8 +29,7 @@ opensips_get_stats() {
opensips_check() {
# if the user did not provide an opensips_cmd
# try to find it in the system
- if [ -z "$opensips_cmd" ]
- then
+ if [ -z "$opensips_cmd" ]; then
require_cmd opensipsctl || return 1
fi
@@ -38,8 +37,7 @@ opensips_check() {
local x
x="$(opensips_get_stats | grep "^opensips_core_")"
# shellcheck disable=SC2181
- if [ ! $? -eq 0 ] || [ -z "$x" ]
- then
+ if [ ! $? -eq 0 ] || [ -z "$x" ]; then
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
diff --git a/collectors/charts.d.plugin/phpfpm/README.md b/collectors/charts.d.plugin/phpfpm/README.md
index d82951aa..36462ba9 100644
--- a/collectors/charts.d.plugin/phpfpm/README.md
+++ b/collectors/charts.d.plugin/phpfpm/README.md
@@ -1,2 +1,6 @@
+# phpfm
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/phpfpm) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fphpfpm%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh b/collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh
index 1af7910b..b1edb237 100644
--- a/collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh
+++ b/collectors/charts.d.plugin/phpfpm/phpfpm.chart.sh
@@ -44,17 +44,7 @@ phpfpm_get() {
return 1
fi
- if [[ "${phpfpm_response[0]}" != "pool:" \
- || "${phpfpm_response[2]}" != "process" \
- || "${phpfpm_response[5]}" != "start" \
- || "${phpfpm_response[12]}" != "accepted" \
- || "${phpfpm_response[15]}" != "listen" \
- || "${phpfpm_response[16]}" != "queue:" \
- || "${phpfpm_response[26]}" != "idle" \
- || "${phpfpm_response[29]}" != "active" \
- || "${phpfpm_response[32]}" != "total" \
- ]]
- then
+ if [[ ${phpfpm_response[0]} != "pool:" || ${phpfpm_response[2]} != "process" || ${phpfpm_response[5]} != "start" || ${phpfpm_response[12]} != "accepted" || ${phpfpm_response[15]} != "listen" || ${phpfpm_response[16]} != "queue:" || ${phpfpm_response[26]} != "idle" || ${phpfpm_response[29]} != "active" || ${phpfpm_response[32]} != "total" ]]; then
error "invalid response from phpfpm status server: ${phpfpm_response[*]}"
return 1
fi
@@ -71,27 +61,13 @@ phpfpm_get() {
phpfpm_total_processes="${phpfpm_response[34]}"
phpfpm_max_active_processes="${phpfpm_response[38]}"
phpfpm_max_children_reached="${phpfpm_response[42]}"
- if [ "${phpfpm_response[43]}" == "slow" ]
- then
- phpfpm_slow_requests="${phpfpm_response[45]}"
+ if [ "${phpfpm_response[43]}" == "slow" ]; then
+ phpfpm_slow_requests="${phpfpm_response[45]}"
else
- phpfpm_slow_requests="-1"
+ phpfpm_slow_requests="-1"
fi
- if [[ -z "${phpfpm_pool}" \
- || -z "${phpfpm_start_time}" \
- || -z "${phpfpm_start_since}" \
- || -z "${phpfpm_accepted_conn}" \
- || -z "${phpfpm_listen_queue}" \
- || -z "${phpfpm_max_listen_queue}" \
- || -z "${phpfpm_listen_queue_len}" \
- || -z "${phpfpm_idle_processes}" \
- || -z "${phpfpm_active_processes}" \
- || -z "${phpfpm_total_processes}" \
- || -z "${phpfpm_max_active_processes}" \
- || -z "${phpfpm_max_children_reached}" \
- ]]
- then
+ if [[ -z ${phpfpm_pool} || -z ${phpfpm_start_time} || -z ${phpfpm_start_since} || -z ${phpfpm_accepted_conn} || -z ${phpfpm_listen_queue} || -z ${phpfpm_max_listen_queue} || -z ${phpfpm_listen_queue_len} || -z ${phpfpm_idle_processes} || -z ${phpfpm_active_processes} || -z ${phpfpm_total_processes} || -z ${phpfpm_max_active_processes} || -z ${phpfpm_max_children_reached} ]]; then
error "empty values got from phpfpm status server: ${phpfpm_response[*]}"
return 1
fi
@@ -106,8 +82,7 @@ phpfpm_check() {
fi
local m
- for m in "${!phpfpm_urls[@]}"
- do
+ for m in "${!phpfpm_urls[@]}"; do
phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
@@ -133,8 +108,7 @@ phpfpm_check() {
# _create is called once, to create the charts
phpfpm_create() {
local m
- for m in "${!phpfpm_urls[@]}"
- do
+ for m in "${!phpfpm_urls[@]}"; do
cat <<EOF
CHART phpfpm_$m.connections '' "PHP-FPM Active Connections" "connections" phpfpm phpfpm.connections line $((phpfpm_priority + 1)) $phpfpm_update_every
DIMENSION active '' absolute 1 1
@@ -147,8 +121,7 @@ DIMENSION requests '' incremental 1 1
CHART phpfpm_$m.performance '' "PHP-FPM Performance" "status" phpfpm phpfpm.performance line $((phpfpm_priority + 3)) $phpfpm_update_every
DIMENSION reached 'max children reached' absolute 1 1
EOF
- if [ $((phpfpm_slow_requests)) -ne -1 ]
- then
+ if [ $((phpfpm_slow_requests)) -ne -1 ]; then
echo "DIMENSION slow 'slow requests' absolute 1 1"
fi
done
@@ -166,8 +139,7 @@ phpfpm_update() {
# remember: KEEP IT SIMPLE AND SHORT
local m
- for m in "${!phpfpm_urls[@]}"
- do
+ for m in "${!phpfpm_urls[@]}"; do
phpfpm_get "${phpfpm_curl_opts[$m]}" "${phpfpm_urls[$m]}"
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then
@@ -187,8 +159,7 @@ END
BEGIN phpfpm_$m.performance $1
SET reached = $((phpfpm_max_children_reached))
EOF
- if [ $((phpfpm_slow_requests)) -ne -1 ]
- then
+ if [ $((phpfpm_slow_requests)) -ne -1 ]; then
echo "SET slow = $((phpfpm_slow_requests))"
fi
echo "END"
diff --git a/collectors/charts.d.plugin/postfix/README.md b/collectors/charts.d.plugin/postfix/README.md
index 5fc265d5..e0dc6330 100644
--- a/collectors/charts.d.plugin/postfix/README.md
+++ b/collectors/charts.d.plugin/postfix/README.md
@@ -1,8 +1,8 @@
-> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
-
# postfix
+> THIS MODULE IS OBSOLETE.
+> USE [THE PYTHON ONE](../../python.d.plugin/postfix) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
The plugin will collect the postfix queue size.
It will create two charts:
@@ -24,3 +24,5 @@ postfix_update_every=15
```
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fpostfix%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/postfix/postfix.chart.sh b/collectors/charts.d.plugin/postfix/postfix.chart.sh
index 8cb938ce..ff59db9f 100644
--- a/collectors/charts.d.plugin/postfix/postfix.chart.sh
+++ b/collectors/charts.d.plugin/postfix/postfix.chart.sh
@@ -22,14 +22,12 @@ postfix_check() {
# - 1 to disable the chart
# try to find the postqueue executable
- if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]
- then
+ if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]; then
# shellcheck disable=SC2230
postfix_postqueue="$(which postqueue 2>/dev/null || command -v postqueue 2>/dev/null)"
fi
- if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]
- then
+ if [ -z "$postfix_postqueue" ] || [ ! -x "$postfix_postqueue" ]; then
# shellcheck disable=SC2154
error "cannot find postqueue. Please set 'postfix_postqueue=/path/to/postqueue' in $confd/postfix.conf"
return 1
@@ -39,7 +37,7 @@ postfix_check() {
}
postfix_create() {
-cat <<EOF
+ cat <<EOF
CHART postfix_local.qemails '' "Postfix Queue Emails" "emails" queue postfix.queued.emails line $((postfix_priority + 1)) $postfix_update_every
DIMENSION emails '' absolute 1 1
CHART postfix_local.qsize '' "Postfix Queue Emails Size" "emails size in KB" queue postfix.queued.size area $((postfix_priority + 2)) $postfix_update_every
@@ -70,9 +68,9 @@ postfix_update() {
postfix_q_emails=0
postfix_q_size=0
- 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" |\
+ 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" |
grep -E "^local postfix_q_(emails|size)=[0-9]+$")"
# write the result of the work.
diff --git a/collectors/charts.d.plugin/sensors/README.md b/collectors/charts.d.plugin/sensors/README.md
index ddc3650d..4f3e46d6 100644
--- a/collectors/charts.d.plugin/sensors/README.md
+++ b/collectors/charts.d.plugin/sensors/README.md
@@ -1,9 +1,10 @@
+# sensors
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/sensors) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
> Unlike the python one, this module can collect temperature on RPi.
-# sensors
The plugin will provide charts for all configured system sensors
@@ -50,3 +51,5 @@ sensors_excluded=()
```
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fsensors%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/sensors/sensors.chart.sh b/collectors/charts.d.plugin/sensors/sensors.chart.sh
index 54368f1e..b9218777 100644
--- a/collectors/charts.d.plugin/sensors/sensors.chart.sh
+++ b/collectors/charts.d.plugin/sensors/sensors.chart.sh
@@ -38,8 +38,7 @@ sensors_find_all_files() {
sensors_find_all_dirs() {
# shellcheck disable=SC2162
- sensors_find_all_files "$1" | while read
- do
+ sensors_find_all_files "$1" | while read; do
dirname "$REPLY"
done | sort -u
}
@@ -51,7 +50,7 @@ sensors_check() {
# - 0 to enable the chart
# - 1 to disable the chart
- [ -z "$( sensors_find_all_files "$sensors_sys_dir" )" ] && error "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
}
@@ -60,15 +59,14 @@ sensors_check_files() {
# also remove not needed sensors
local f v excluded
- for f in "$@"
- do
+ for f in "$@"; do
[ ! -f "$f" ] && continue
for ex in "${sensors_excluded[@]}"; do
[[ $f =~ .*$ex$ ]] && excluded='1' && break
done
- [ "$excluded" != "1" ] && v="$( cat "$f" )" || v=0
- v=$(( v + 1 - 1 ))
+ [ "$excluded" != "1" ] && v="$(cat "$f")" || v=0
+ v=$((v + 1 - 1))
[ $v -ne 0 ] && echo "$f" && continue
excluded=
@@ -81,15 +79,14 @@ sensors_check_temp_type() {
# disabled sensors have the value 0
local f t v
- for f in "$@"
- do
+ for f in "$@"; do
# shellcheck disable=SC2001
- t=$( echo "$f" | sed "s|_input$|_type|g" )
+ t=$(echo "$f" | sed "s|_input$|_type|g")
[ "$f" = "$t" ] && echo "$f" && continue
[ ! -f "$t" ] && echo "$f" && continue
- v="$( cat "$t" )"
- v=$(( v + 1 - 1 ))
+ v="$(cat "$t")"
+ v=$((v + 1 - 1))
[ $v -ne 0 ] && echo "$f" && continue
error "$f is disabled"
@@ -105,120 +102,119 @@ sensors_create() {
# - the highest speed we can achieve -
[ $sensors_source_update -eq 1 ] && echo >"$TMP_DIR/sensors.sh" "sensors_update() {"
- for path in $( sensors_find_all_dirs "$sensors_sys_dir" | sort -u )
- do
- dir=$( basename "$path" )
+ for path in $(sensors_find_all_dirs "$sensors_sys_dir" | sort -u); do
+ dir=$(basename "$path")
device=
subsystem=
id=
type=
name=
- [ -h "$path/device" ] && device=$( readlink -f "$path/device" )
- [ ! -z "$device" ] && device=$( basename "$device" )
+ [ -h "$path/device" ] && device=$(readlink -f "$path/device")
+ [ ! -z "$device" ] && device=$(basename "$device")
[ -z "$device" ] && device="$dir"
- [ -h "$path/subsystem" ] && subsystem=$( readlink -f "$path/subsystem" )
- [ ! -z "$subsystem" ] && subsystem=$( basename "$subsystem" )
+ [ -h "$path/subsystem" ] && subsystem=$(readlink -f "$path/subsystem")
+ [ ! -z "$subsystem" ] && subsystem=$(basename "$subsystem")
[ -z "$subsystem" ] && subsystem="$dir"
- [ -f "$path/name" ] && name=$( cat "$path/name" )
+ [ -f "$path/name" ] && name=$(cat "$path/name")
[ -z "$name" ] && name="$dir"
- [ -f "$path/type" ] && type=$( cat "$path/type" )
+ [ -f "$path/type" ] && type=$(cat "$path/type")
[ -z "$type" ] && type="$dir"
- id="$( fixid "$device.$subsystem.$dir" )"
+ id="$(fixid "$device.$subsystem.$dir")"
debug "path='$path', dir='$dir', device='$device', subsystem='$subsystem', id='$id', name='$name'"
- for mode in temperature voltage fans power current energy humidity
- do
+ for mode in temperature voltage fans power current energy humidity; do
files=
multiplier=1
divisor=1
algorithm="absolute"
case $mode in
- temperature)
- files="$( ls "$path"/temp*_input 2>/dev/null; ls "$path/temp" 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- files="$( sensors_check_temp_type "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.temp_$id '' '$name Temperature' 'Celsius' 'temperature' 'sensors.temp' line $((sensors_priority + 1)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.temp_$id \$1\""
- divisor=1000
- ;;
-
- voltage)
- files="$( ls "$path"/in*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.volt_$id '' '$name Voltage' 'Volts' 'voltage' 'sensors.volt' line $((sensors_priority + 2)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.volt_$id \$1\""
- divisor=1000
- ;;
-
- current)
- files="$( ls "$path"/curr*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.curr_$id '' '$name Current' 'Ampere' 'current' 'sensors.curr' line $((sensors_priority + 3)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.curr_$id \$1\""
- divisor=1000
- ;;
-
- power)
- files="$( ls "$path"/power*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.power_$id '' '$name Power' 'Watt' 'power' 'sensors.power' line $((sensors_priority + 4)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.power_$id \$1\""
- divisor=1000000
- ;;
-
- fans)
- files="$( ls "$path"/fan*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.fan_$id '' '$name Fans Speed' 'Rotations / Minute' 'fans' 'sensors.fans' line $((sensors_priority + 5)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.fan_$id \$1\""
- ;;
-
- energy)
- files="$( ls "$path"/energy*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.energy_$id '' '$name Energy' 'Joule' 'energy' 'sensors.energy' areastack $((sensors_priority + 6)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.energy_$id \$1\""
- algorithm="incremental"
- divisor=1000000
- ;;
-
- humidity)
- files="$( ls "$path"/humidity*_input 2>/dev/null )"
- files="$( sensors_check_files "$files" )"
- [ -z "$files" ] && continue
- echo "CHART sensors.humidity_$id '' '$name Humidity' 'Percent' 'humidity' 'sensors.humidity' line $((sensors_priority + 7)) $sensors_update_every"
- echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.humidity_$id \$1\""
- divisor=1000
- ;;
-
- *)
- continue
- ;;
+ temperature)
+ files="$(
+ ls "$path"/temp*_input 2>/dev/null
+ ls "$path/temp" 2>/dev/null
+ )"
+ files="$(sensors_check_files "$files")"
+ files="$(sensors_check_temp_type "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.temp_$id '' '$name Temperature' 'Celsius' 'temperature' 'sensors.temp' line $((sensors_priority + 1)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.temp_$id \$1\""
+ divisor=1000
+ ;;
+
+ voltage)
+ files="$(ls "$path"/in*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.volt_$id '' '$name Voltage' 'Volts' 'voltage' 'sensors.volt' line $((sensors_priority + 2)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.volt_$id \$1\""
+ divisor=1000
+ ;;
+
+ current)
+ files="$(ls "$path"/curr*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.curr_$id '' '$name Current' 'Ampere' 'current' 'sensors.curr' line $((sensors_priority + 3)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.curr_$id \$1\""
+ divisor=1000
+ ;;
+
+ power)
+ files="$(ls "$path"/power*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.power_$id '' '$name Power' 'Watt' 'power' 'sensors.power' line $((sensors_priority + 4)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.power_$id \$1\""
+ divisor=1000000
+ ;;
+
+ fans)
+ files="$(ls "$path"/fan*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.fan_$id '' '$name Fans Speed' 'Rotations / Minute' 'fans' 'sensors.fans' line $((sensors_priority + 5)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.fan_$id \$1\""
+ ;;
+
+ energy)
+ files="$(ls "$path"/energy*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.energy_$id '' '$name Energy' 'Joule' 'energy' 'sensors.energy' areastack $((sensors_priority + 6)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.energy_$id \$1\""
+ algorithm="incremental"
+ divisor=1000000
+ ;;
+
+ humidity)
+ files="$(ls "$path"/humidity*_input 2>/dev/null)"
+ files="$(sensors_check_files "$files")"
+ [ -z "$files" ] && continue
+ echo "CHART sensors.humidity_$id '' '$name Humidity' 'Percent' 'humidity' 'sensors.humidity' line $((sensors_priority + 7)) $sensors_update_every"
+ echo >>"$TMP_DIR/sensors.sh" "echo \"BEGIN sensors.humidity_$id \$1\""
+ divisor=1000
+ ;;
+
+ *)
+ continue
+ ;;
esac
- for x in $files
- do
+ for x in $files; do
file="$x"
- fid="$( fixid "$file" )"
- lfile="$( basename "$file" | sed "s|_input$|_label|g" )"
- labelname="$( basename "$file" | sed "s|_input$||g" )"
+ fid="$(fixid "$file")"
+ lfile="$(basename "$file" | sed "s|_input$|_label|g")"
+ labelname="$(basename "$file" | sed "s|_input$||g")"
- if [ ! "$path/$lfile" = "$file" ] && [ -f "$path/$lfile" ]
- then
- labelname="$( cat "$path/$lfile" )"
+ if [ ! "$path/$lfile" = "$file" ] && [ -f "$path/$lfile" ]; then
+ labelname="$(cat "$path/$lfile")"
fi
echo "DIMENSION $fid '$labelname' $algorithm $multiplier $divisor"
@@ -252,4 +248,3 @@ sensors_update() {
return 0
}
-
diff --git a/collectors/charts.d.plugin/squid/README.md b/collectors/charts.d.plugin/squid/README.md
index 0934ccfc..cfb61790 100644
--- a/collectors/charts.d.plugin/squid/README.md
+++ b/collectors/charts.d.plugin/squid/README.md
@@ -1,9 +1,8 @@
-> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
-
-
# squid
+> THIS MODULE IS OBSOLETE.
+> USE [THE PYTHON ONE](../../python.d.plugin/squid) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
The plugin will monitor a squid server.
It will produce 4 charts:
@@ -64,3 +63,5 @@ squid_update_every=5
```
---
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Fsquid%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/squid/squid.chart.sh b/collectors/charts.d.plugin/squid/squid.chart.sh
index cf5d1d78..ebddb32c 100644
--- a/collectors/charts.d.plugin/squid/squid.chart.sh
+++ b/collectors/charts.d.plugin/squid/squid.chart.sh
@@ -25,13 +25,10 @@ squid_get_stats() {
squid_autodetect() {
local host="127.0.0.1" port url x
- for port in 3128 8080
- do
- for url in "cache_object://$host:$port/counters" "/squid-internal-mgr/counters"
- do
+ for port in 3128 8080; do
+ for url in "cache_object://$host:$port/counters" "/squid-internal-mgr/counters"; do
x=$(squid_get_stats_internal "$host" "$port" "$url" | grep client_http.requests)
- if [ ! -z "$x" ]
- then
+ if [ ! -z "$x" ]; then
squid_host="$host"
squid_port="$port"
squid_url="$url"
@@ -50,8 +47,7 @@ squid_check() {
require_cmd sed || return 1
require_cmd egrep || return 1
- if [ -z "$squid_host" ] || [ -z "$squid_port" ] || [ -z "$squid_url" ]
- then
+ if [ -z "$squid_host" ] || [ -z "$squid_port" ] || [ -z "$squid_url" ]; then
squid_autodetect || return 1
fi
@@ -59,8 +55,7 @@ squid_check() {
local x
x="$(squid_get_stats | grep client_http.requests)"
# shellcheck disable=SC2181
- if [ ! $? -eq 0 ] || [ -z "$x" ]
- then
+ if [ ! $? -eq 0 ] || [ -z "$x" ]; then
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
@@ -93,7 +88,6 @@ EOF
return 0
}
-
squid_update() {
# the first argument to this function is the microseconds since last update
# pass this parameter to the BEGIN statement (see bellow).
@@ -114,8 +108,8 @@ squid_update() {
# even if something goes wrong, no other code can be executed
# shellcheck disable=SC1117
- eval "$(squid_get_stats |\
- sed -e "s/ \+/ /g" -e "s/\./_/g" -e "s/^\([a-z0-9_]\+\) *= *\([0-9]\+\)$/local squid_\1=\2/g" |\
+ eval "$(squid_get_stats |
+ sed -e "s/ \+/ /g" -e "s/\./_/g" -e "s/^\([a-z0-9_]\+\) *= *\([0-9]\+\)$/local squid_\1=\2/g" |
grep -E "^local squid_(client_http|server_all)_[a-z0-9_]+=[0-9]+$")"
# write the result of the work.
diff --git a/collectors/charts.d.plugin/tomcat/README.md b/collectors/charts.d.plugin/tomcat/README.md
index d82951aa..84337860 100644
--- a/collectors/charts.d.plugin/tomcat/README.md
+++ b/collectors/charts.d.plugin/tomcat/README.md
@@ -1,2 +1,6 @@
+# tomcat
+
> THIS MODULE IS OBSOLETE.
-> USE THE PYTHON ONE - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+> USE [THE PYTHON ONE](../../python.d.plugin/tomcat) - IT SUPPORTS MULTIPLE JOBS AND IT IS MORE EFFICIENT
+
+[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fcollectors%2Fcharts.d.plugin%2Ftomcat%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)]()
diff --git a/collectors/charts.d.plugin/tomcat/tomcat.chart.sh b/collectors/charts.d.plugin/tomcat/tomcat.chart.sh
index 294487b8..9ca75e63 100644
--- a/collectors/charts.d.plugin/tomcat/tomcat.chart.sh
+++ b/collectors/charts.d.plugin/tomcat/tomcat.chart.sh
@@ -32,24 +32,23 @@ tomcat_priority=60000
# will be in the proper units
tomcat_decimal_detail=1000000
-# used by volume chart to convert bytes to KB
-tomcat_decimal_KB_detail=1000
+# used by volume chart to convert bytes to kB
+tomcat_decimal_kB_detail=1000
tomcat_check() {
require_cmd xmlstarlet || return 1
-
# check if url, username, passwords are set
if [ -z "${tomcat_url}" ]; then
- error "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
# shellcheck disable=SC2154
if [ -z "${tomcatUser}" ]; then
- error "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}"
@@ -59,7 +58,7 @@ tomcat_check() {
# check backwards compatibility
# shellcheck disable=SC2154
if [ -z "${tomcatPassword}" ]; then
- error "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}"
@@ -69,8 +68,7 @@ tomcat_check() {
# check if we can get to tomcat's status page
tomcat_get
# shellcheck disable=2181
- if [ $? -ne 0 ]
- then
+ if [ $? -ne 0 ]; then
error "cannot get to status page on URL '${tomcat_url}'. Please make sure tomcat url, username and password are correct."
return 1
fi
@@ -84,8 +82,12 @@ tomcat_check() {
tomcat_get() {
# collect tomcat values
- tomcat_port="$(IFS=/ read -ra a <<< "$tomcat_url"; hostport=${a[2]}; echo "${hostport#*:}")"
- mapfile -t lines < <(run curl -u "$tomcat_user":"$tomcat_password" -Ss ${tomcat_curl_opts} "$tomcat_url" |\
+ tomcat_port="$(
+ IFS=/ read -ra a <<<"$tomcat_url"
+ hostport=${a[2]}
+ echo "${hostport#*:}"
+ )"
+ 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 \
@@ -107,8 +109,8 @@ tomcat_create() {
cat <<EOF
CHART tomcat.accesses '' "tomcat requests" "requests/s" statistics tomcat.accesses area $((tomcat_priority + 8)) $tomcat_update_every
DIMENSION accesses '' incremental
-CHART tomcat.volume '' "tomcat volume" "KB/s" volume tomcat.volume area $((tomcat_priority + 5)) $tomcat_update_every
-DIMENSION volume '' incremental divisor ${tomcat_decimal_KB_detail}
+CHART tomcat.volume '' "tomcat volume" "kB/s" volume tomcat.volume area $((tomcat_priority + 5)) $tomcat_update_every
+DIMENSION volume '' incremental divisor ${tomcat_decimal_kB_detail}
CHART tomcat.threads '' "tomcat threads" "current threads" statistics tomcat.threads line $((tomcat_priority + 6)) $tomcat_update_every
DIMENSION current '' absolute 1
DIMENSION busy '' absolute 1