charts.d.plugin: add keepalive to global_update (#8529)
Ilya Mashchenko committed
Mar 30, 2020 at 15:38 UTC
71e1ef8c38181ea5bb491b020f30eeb11c10069f
1 file changed
+8
collectors/charts.d.plugin/charts.d.plugin.in
+8
@@ -612,6 +612,12 @@ debug "run_charts='$run_charts'"
612
613
[ -z "$run_charts" ] && fatal "No charts to collect data from."
614
615
+keepalive() {
616
+ if [ ! -t 1 ] && ! printf "\n"; then
617
+ chartsd_cleanup
618
+ fi
619
+}
620
+
621
declare -A charts_last_update=() charts_update_every=() charts_retries=() charts_next_update=() charts_run_counter=() charts_serial_failures=()
622
global_update() {
623
local exit_at \
@@ -642,6 +648,8 @@ global_update() {
648
649
# the main loop
650
while [ "${#next_charts[@]}" -gt 0 ]; do
651
+ keepalive
652
+
653
c=$((c + 1))
654
now_charts=("${next_charts[@]}")
655
next_charts=()