Projet

Général

Profil

Révision d9ab69e0

IDd9ab69e0a11462e21df8d2885efcbf91ec5a55c0
Parent bc0bab7a
Enfant b9a08b36

Ajouté par Kris Popendorf il y a plus de 12 ans

Fixes bandwidth_ to successfully init new installs.

Previously the script would try to divide by 0 for calculating rates
on the first run, and crash before getting to store() to write initial
values thus never initing itself. This fixes that, and makes it a
little easier to debug in case of future crashes (no need for 'eval'
wrapper).

Voir les différences:

plugins/network/bandwidth_
75 75
my $unix_ts  = time;
76 76
my $rollover = 4294967295;
77 77

  
78
eval { init(); };
78
init();
79 79

  
80 80
sub autoconf {
81 81
    $0 =~ /bandwidth_(.+)*$/;
......
263 263

  
264 264
sub munin_output {
265 265
    my $period    = $unix_ts - $oldest_ts;
266
    return unless $period;  #can't estimate anything from a single point, so don't.
266 267
    my $total30   = $input_30days + $output_30days;
267 268
    my $average30 = $total30 / $period;
268 269
    print "average.value  $average30\n";

Formats disponibles : Unified diff