1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-24 18:07:20 +00:00

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).
This commit is contained in:
Kris Popendorf 2013-04-23 11:18:40 +09:00
parent bc0bab7a0e
commit d9ab69e0a1

View file

@ -75,7 +75,7 @@ my $count30 = 2592000; # The number of seconds in 30 days
my $unix_ts = time;
my $rollover = 4294967295;
eval { init(); };
init();
sub autoconf {
$0 =~ /bandwidth_(.+)*$/;
@ -263,6 +263,7 @@ sub sum_old {
sub munin_output {
my $period = $unix_ts - $oldest_ts;
return unless $period; #can't estimate anything from a single point, so don't.
my $total30 = $input_30days + $output_30days;
my $average30 = $total30 / $period;
print "average.value $average30\n";