## <a id="objecttype-checkcomponent"></a> CheckerComponent
-The checker component is responsible for scheduling active checks. There are no configurable options.
+The checker component is responsible for scheduling active checks.
Example:
object CheckerComponent "checker" { }
+Configuration Attributes:
+
+ Name |Description
+ --------------------|----------------
+ concurrent\_checks |**Optional.** The maximum number of concurrent checks. Defaults to 512.
+
## <a id="objecttype-checkresultreader"></a> CheckResultReader
Reads Icinga 1.x check results from a directory. This functionality is provided
ConfigObject::OnActiveChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
ConfigObject::OnPausedChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
+ Checkable::OnNewCheckResult.connect(bind(&CheckerComponent::CheckResultHandler, this, _1));
Checkable::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1));
}
double wait = checkable->GetNextCheck() - Utility::GetTime();
- if (wait > 0) {
+ if (wait > 0 || m_PendingCheckables.size() >= GetConcurrentChecks()) {
/* Wait for the next check. */
m_CV.timed_wait(lock, boost::posix_time::milliseconds(wait * 1000));
Log(LogCritical, "checker", output);
}
-
- {
- boost::mutex::scoped_lock lock(m_Mutex);
-
- /* remove the object from the list of pending objects; if it's not in the
- * list this was a manual (i.e. forced) check and we must not re-add the
- * object to the list because it's already there. */
- CheckerComponent::CheckableSet::iterator it;
- it = m_PendingCheckables.find(checkable);
- if (it != m_PendingCheckables.end()) {
- m_PendingCheckables.erase(it);
-
- if (checkable->IsActive())
- m_IdleCheckables.insert(checkable);
-
- m_CV.notify_all();
- }
- }
-
- Log(LogDebug, "CheckerComponent")
- << "Check finished for object '" << checkable->GetName() << "'";
}
void CheckerComponent::ResultTimerHandler(void)
}
}
+void CheckerComponent::CheckResultHandler(const Checkable::Ptr& checkable)
+{
+ {
+ boost::mutex::scoped_lock lock(m_Mutex);
+
+ /* remove the object from the list of pending objects; if it's not in the
+ * list this was a manual (i.e. forced) check and we must not re-add the
+ * object to the list because it's already there. */
+ CheckerComponent::CheckableSet::iterator it;
+ it = m_PendingCheckables.find(checkable);
+ if (it != m_PendingCheckables.end()) {
+ m_PendingCheckables.erase(it);
+
+ if (checkable->IsActive())
+ m_IdleCheckables.insert(checkable);
+
+ m_CV.notify_all();
+ }
+ }
+
+ Log(LogDebug, "CheckerComponent")
+ << "Check finished for object '" << checkable->GetName() << "'";
+}
+
void CheckerComponent::NextCheckChangedHandler(const Checkable::Ptr& checkable)
{
boost::mutex::scoped_lock lock(m_Mutex);
{
CONTEXT("Executing check for object '" + GetName() + "'");
+ /* keep track of scheduling info in case the check type doesn't provide its own information */
+ double scheduled_start = GetNextCheck();
+ double before_check = Utility::GetTime();
+
UpdateNextCheck();
bool reachable = IsReachable();
SetLastReachable(reachable);
}
- /* keep track of scheduling info in case the check type doesn't provide its own information */
- double scheduled_start = GetNextCheck();
- double before_check = Utility::GetTime();
-
CheckResult::Ptr cr = new CheckResult();
cr->SetScheduleStart(scheduled_start);