Skip to content

Commit

Permalink
- Ignore values that are too old for the RRD. Otherwise it will rejec…
Browse files Browse the repository at this point in the history
…t the whole update
  • Loading branch information
steveschnepp committed May 18, 2011
1 parent b72dba5 commit 432be0f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions master/lib/Munin/Master/UpdateWorker.pm
Expand Up @@ -831,7 +831,7 @@ sub _update_rrd_file {
# Some kind of mismatch between fetch and config can cause this.
return if !defined($values);

my $last_updated_timestamp = 0;
my $last_updated_timestamp = RRDs::last($rrd_file);
my @update_rrd_data;
if ($config->{"rrdcached"} eq "on") {
if($RRDs::VERSION >= 1.3){
Expand All @@ -846,6 +846,10 @@ sub _update_rrd_file {
my $value = $values->[$i];
my $when = $ds_values->{when}[$i];

# Ignore values that are too old for the RRD.
# Otherwise it will reject the whole update
next if ($when <= $last_updated_timestamp);

if ($value =~ /\d[Ee]([+-]?\d+)$/) {
# Looks like scientific format. RRDtool does not
# like it so we convert it.
Expand All @@ -862,7 +866,7 @@ sub _update_rrd_file {
# Schedule for addition
push @update_rrd_data, "$when:$value";

$last_updated_timestamp = max($last_updated_timestamp, $when);
$last_updated_timestamp = $when;
}

DEBUG "[DEBUG] Updating $rrd_file with @update_rrd_data";
Expand Down

0 comments on commit 432be0f

Please sign in to comment.