From 2e85f9325a797977eea9dfea0a925775ddd211d9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Feb 2021 12:49:00 +0100 Subject: Merging upstream version 1.29.0. Signed-off-by: Daniel Baumann --- collectors/charts.d.plugin/charts.d.plugin.in | 54 ++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 10 deletions(-) (limited to 'collectors/charts.d.plugin/charts.d.plugin.in') diff --git a/collectors/charts.d.plugin/charts.d.plugin.in b/collectors/charts.d.plugin/charts.d.plugin.in index 0df6c30c3..62363f3db 100755 --- a/collectors/charts.d.plugin/charts.d.plugin.in +++ b/collectors/charts.d.plugin/charts.d.plugin.in @@ -275,20 +275,26 @@ fixid() { tr "[A-Z]" "[a-z]" } +isvarset() { + [ -n "$1" ] && [ "$1" != "unknown" ] && [ "$1" != "none" ] + return $? +} + +getosid() { + if isvarset "${NETDATA_CONTAINER_OS_ID}"; then + echo "${NETDATA_CONTAINER_OS_ID}" + else + echo "${NETDATA_SYSTEM_OS_ID}" + fi +} + run() { local ret pid="${BASHPID}" t if [ "z${1}" = "z-t" -a "${2}" != "0" ]; then t="${2}" shift 2 - case "${NETDATA_SYSTEM_OS_ID}" in - "alpine") - timeout -t ${t} "${@}" 2>"${TMP_DIR}/run.${pid}" - ;; - *) - timeout ${t} "${@}" 2>"${TMP_DIR}/run.${pid}" - ;; - esac + timeout "${t}" "${@}" 2>"${TMP_DIR}/run.${pid}" ret=$? else "${@}" 2>"${TMP_DIR}/run.${pid}" @@ -390,14 +396,34 @@ declare -A charts_enable_keyword=( ['tomcat']="force" ) +declare -A obsolete_charts=( + ['apache']="python.d.plugin module" + ['cpu_apps']="apps.plugin" + ['cpufreq']="proc plugin" + ['exim']="python.d.plugin module" + ['hddtemp']="python.d.plugin module" + ['load_average']="proc plugin" + ['mem_apps']="proc plugin" + ['mysql']="python.d.plugin module" + ['nginx']="python.d.plugin module" + ['phpfpm']="python.d.plugin module" + ['postfix']="python.d.plugin module" + ['squid']="python.d.plugin module" + ['tomcat']="python.d.plugin module" +) + all_enabled_charts() { - local charts= enabled= required= + local charts enabled required # find all enabled charts - for chart in $(all_charts); do MODULE_NAME="${chart}" + if [ -n "${obsolete_charts["$MODULE_NAME"]}" ]; then + debug "is replaced by ${obsolete_charts["$MODULE_NAME"]}, skipping it." + continue + fi + eval "enabled=\$$chart" if [ -z "${enabled}" ]; then enabled="${enable_all_charts}" @@ -578,6 +604,12 @@ debug "run_charts='$run_charts'" [ -z "$run_charts" ] && fatal "No charts to collect data from." +keepalive() { + if [ ! -t 1 ] && ! printf "\n"; then + chartsd_cleanup + fi +} + declare -A charts_last_update=() charts_update_every=() charts_retries=() charts_next_update=() charts_run_counter=() charts_serial_failures=() global_update() { local exit_at \ @@ -608,6 +640,8 @@ global_update() { # the main loop while [ "${#next_charts[@]}" -gt 0 ]; do + keepalive + c=$((c + 1)) now_charts=("${next_charts[@]}") next_charts=() -- cgit v1.2.3