From 71e1ef8c38181ea5bb491b020f30eeb11c10069f Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Mon, 30 Mar 2020 15:38:07 +0300 Subject: charts.d.plugin: add keepalive to global_update (#8529) --- collectors/charts.d.plugin/charts.d.plugin.in | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'collectors') diff --git a/collectors/charts.d.plugin/charts.d.plugin.in b/collectors/charts.d.plugin/charts.d.plugin.in index fc67a9af93..e28926b636 100755 --- a/collectors/charts.d.plugin/charts.d.plugin.in +++ b/collectors/charts.d.plugin/charts.d.plugin.in @@ -612,6 +612,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 \ @@ -642,6 +648,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