From 0dc3172e210fea556ccf2bf09f55fe011d9dedc9 Mon Sep 17 00:00:00 2001 From: Steve Schnepp Date: Wed, 18 May 2011 16:06:54 +0000 Subject: [PATCH] - Ignore values that are too old for the RRD. Otherwise it will reject the whole update git-svn-id: svn://munin-monitoring.org/munin/trunk@4196 47311dc8-50f3-0310-b975-824c5c5ab7df --- master/lib/Munin/Master/UpdateWorker.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/master/lib/Munin/Master/UpdateWorker.pm b/master/lib/Munin/Master/UpdateWorker.pm index f604a32a..c3e7d850 100644 --- a/master/lib/Munin/Master/UpdateWorker.pm +++ b/master/lib/Munin/Master/UpdateWorker.pm @@ -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){ @@ -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. @@ -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";