From 08e7243a3d45b0161416493e76a32e1723a8f3f4 Mon Sep 17 00:00:00 2001
From: Mark Harrison <mark@mivok.net>
Date: Fri, 1 Mar 2013 13:00:24 -0500
Subject: [PATCH] Fix per-check interval/cached metrics

Credit: Michal Racek <michal.racek@t-systems.sk>

In Resmon 1, it was possible to add an interval parameter to an individual
check to give it a larger check interval than regular checks (cached results
would be returned in the meantime). This functionality wasn't properly carried
over into resmon 2, and this commit fixes that.
---
 lib/Resmon/Module.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Resmon/Module.pm b/lib/Resmon/Module.pm
index 9b8746d..03bfa5e 100644
--- a/lib/Resmon/Module.pm
+++ b/lib/Resmon/Module.pm
@@ -28,9 +28,9 @@ sub cache_metrics {
 
 sub get_cached_metrics {
     my $self = shift;
-    return undef unless $self->{check_interval};
+    return undef unless $self->{config}->{interval};
     my $now = time;
-    if(($self->{lastupdate} + $self->{check_interval}) >= $now) {
+    if(($self->{lastupdate} + $self->{config}->{interval}) >= $now) {
         return $self->{lastmetrics};
     }
     return undef;
-- 
GitLab