From 4a39b56c7aefdd9794add4468c7dbe87ff683ce8 Mon Sep 17 00:00:00 2001
From: Daniel Black <daniel.black@openquery.com>
Date: Sun, 26 Oct 2014 17:36:29 +1100
Subject: [PATCH] Run munin-asyncd fetching on wall clock type
Patch by Picnic Pete: https://github.com/picnicpete
---
node/_bin/munin-asyncd.in | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/node/_bin/munin-asyncd.in b/node/_bin/munin-asyncd.in
index 8efe50f..4811b2d 100644
--- a/node/_bin/munin-asyncd.in
+++ b/node/_bin/munin-asyncd.in
@@ -160,9 +160,14 @@ MAIN: while($keepgoing) {
next;
}
- # Should update it
- $last_updated{$plugin} = $when;
- $when_next = min($when_next, $when + max($plugin_rate, $minrate));
+ # Should update it - based on wall clock time
+ my $should_have_been = $when - ($when % $plugin_rate);
+ my $should_be_next = $should_have_been + $plugin_rate;
+
+ $last_updated{$plugin} = $should_have_been;
+ if ($should_be_next < $when_next) {
+ $when_next = $should_be_next;
+ }
if ($do_fork && fork()) {
# parent, return directly