]> arthur.barton.de Git - netdata.git/commitdiff
charts.d restarts every hour to prevent memory leaks of the shell; initial update...
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Wed, 21 May 2014 17:57:24 +0000 (20:57 +0300)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Wed, 21 May 2014 17:57:24 +0000 (20:57 +0300)
apps_plugin.c
plugins.d/charts.d.plugin
plugins.d/tc-qos-helper.sh

index bfe8b8aa48d2bd0cb2699ae47944c538185d6ce7..bfae20abea6056d7523c8e6a00e47ea08e4f6520 100755 (executable)
@@ -890,7 +890,10 @@ void show_dimensions(void)
                gettimeofday(&last, NULL);
                getrusage(RUSAGE_SELF, &me_last);
 
-               usec = update_every * 1000000ULL;
+               // the first time, give a zero to allow
+               // netdata calibrate to the current time
+               // usec = update_every * 1000000ULL;
+               usec = 0ULL;
                cpuuser = 0;
                cpusyst = 0;
        }
index dfd8e06af3248ea2fe60cfc0df287f0d47d49436..3127fd3edaa4020ddf6dc497ff08e0dd3e529ddc 100755 (executable)
@@ -276,8 +276,12 @@ done
 # -----------------------------------------------------------------------------
 # update dimensions
 global_update() {
+       local exit_after=$((3600 / update_every))
+
+       local c=0
        while [ 1 ]
        do
+               local c=$((c + 1))
                local now_charts="$run_charts"
                local run_charts=
 
@@ -295,6 +299,10 @@ global_update() {
                        local dt=$(( (now - last) * 1000 ))
                        eval "last_update_$chart=$now"
 
+                       # the first call should not give a duration
+                       # so that netdata calibrates to current time
+                       test $c -eq 1 && local dt=
+
                        $chart$charts_update $dt
                        if [ $? -eq 0 ]
                        then
@@ -312,6 +320,8 @@ global_update() {
                        # wait the time you are required to
                        loopsleepms $debug_time $update_every
                fi
+
+               test $c -gt $exit_after && exit 0
        done
 }
 
index c8914c491cae1621e27947d0dd9c429b0e265341..0c43af737a055d3075907f010fe196bd60ea73b9 100755 (executable)
@@ -84,7 +84,7 @@ do
                show_tc $d
        done
 
-       [ $gc -gt $exit_after ] && exit 0
-       
        loopsleepms $sleep_time
+
+       test $gc -gt $exit_after && exit 0
 done