@@ -135,6 +135,7 @@ void CheckerComponent::CheckThreadProc()
135
135
bool forced = checkable->GetForceNextCheck ();
136
136
bool check = true ;
137
137
bool notifyNextCheck = false ;
138
+ double nextCheck = -1 ;
138
139
139
140
if (!forced) {
140
141
if (!checkable->IsReachable (DependencyCheckExecution)) {
@@ -162,13 +163,25 @@ void CheckerComponent::CheckThreadProc()
162
163
163
164
TimePeriod::Ptr tp = checkable->GetCheckPeriod ();
164
165
165
- if (tp && !tp->IsInside (Utility::GetTime ())) {
166
- Log (LogNotice, " CheckerComponent" )
167
- << " Skipping check for object '" << checkable->GetName ()
168
- << " ': not in check period '" << tp->GetName () << " '" ;
166
+ if (tp) {
167
+ auto ts (Utility::GetTime ());
168
+ ObjectLock oLock (tp);
169
169
170
- check = false ;
171
- notifyNextCheck = true ;
170
+ if (!tp->IsInside (ts)) {
171
+ nextCheck = tp->FindNextTransition (ts);
172
+
173
+ if (nextCheck <= 0 ) {
174
+ nextCheck = tp->GetValidEnd ();
175
+ }
176
+
177
+ Log (LogNotice, " CheckerComponent" )
178
+ << " Skipping check for object '" << checkable->GetName ()
179
+ << " ', as not in check period '" << tp->GetName () << " ', until "
180
+ << Utility::FormatDateTime (" %Y-%m-%d %H:%M:%S %z" , nextCheck);
181
+
182
+ check = false ;
183
+ notifyNextCheck = true ;
184
+ }
172
185
}
173
186
}
174
187
@@ -177,10 +190,14 @@ void CheckerComponent::CheckThreadProc()
177
190
m_IdleCheckables.insert (GetCheckableScheduleInfo (checkable));
178
191
lock.unlock ();
179
192
180
- Log (LogDebug, " CheckerComponent" )
181
- << " Checks for checkable '" << checkable->GetName () << " ' are disabled. Rescheduling check." ;
193
+ if (nextCheck > 0 ) {
194
+ checkable->SetNextCheck (nextCheck);
195
+ } else {
196
+ Log (LogDebug, " CheckerComponent" )
197
+ << " Checks for checkable '" << checkable->GetName () << " ' are disabled. Rescheduling check." ;
182
198
183
- checkable->UpdateNextCheck ();
199
+ checkable->UpdateNextCheck ();
200
+ }
184
201
185
202
if (notifyNextCheck) {
186
203
// Trigger update event for Icinga DB
0 commit comments