mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 02:18:08 +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:
parent
bc0bab7a0e
commit
d9ab69e0a1
1 changed files with 2 additions and 1 deletions
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue