mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 07:04:37 +02:00
commit
b023e5af86
@ -140,7 +140,7 @@ void CheckerComponent::CheckThreadProc(void)
|
|||||||
Log(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
|
Log(LogDebug, "checker", "Executing service check for '" + service->GetName() + "'");
|
||||||
|
|
||||||
CheckerComponent::Ptr self = GetSelf();
|
CheckerComponent::Ptr self = GetSelf();
|
||||||
Utility::QueueAsyncCallback(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, service));
|
m_Pool.Post(boost::bind(&CheckerComponent::ExecuteCheckHelper, self, service));
|
||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,8 @@ private:
|
|||||||
void NextCheckChangedHandler(const Service::Ptr& service);
|
void NextCheckChangedHandler(const Service::Ptr& service);
|
||||||
|
|
||||||
void RescheduleCheckTimer(void);
|
void RescheduleCheckTimer(void);
|
||||||
|
|
||||||
|
ThreadPool m_Pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,9 @@ start() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting Icinga 2: "
|
echo "Starting Icinga 2: "
|
||||||
ulimit -n 8192
|
ulimit -n 32768
|
||||||
|
ulimit -s 512
|
||||||
|
ulimit -u 16384
|
||||||
$DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG -u $ICINGA2_USER -g $ICINGA2_GROUP
|
$DAEMON -c $ICINGA2_CONFIG_FILE -d -e $ICINGA2_ERROR_LOG -u $ICINGA2_USER -g $ICINGA2_GROUP
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "base/debug.h"
|
#include "base/debug.h"
|
||||||
#include "base/utility.h"
|
#include "base/utility.h"
|
||||||
#include "base/scriptvariable.h"
|
#include "base/scriptvariable.h"
|
||||||
|
#include "base/application.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
@ -252,9 +253,13 @@ void ThreadPool::ManagerThreadProc(void)
|
|||||||
if (alive + tthreads < 8)
|
if (alive + tthreads < 8)
|
||||||
tthreads = 8 - alive;
|
tthreads = 8 - alive;
|
||||||
|
|
||||||
|
/* Don't kill more than 8 threads at once. */
|
||||||
|
if (tthreads < -8)
|
||||||
|
tthreads = -8;
|
||||||
|
|
||||||
/* Spawn more workers if there are outstanding work items. */
|
/* Spawn more workers if there are outstanding work items. */
|
||||||
if (tthreads > 0 && pending > 0)
|
if (tthreads > 0 && pending > 0)
|
||||||
tthreads = 8;
|
tthreads = (Utility::GetTime() - Application::GetStartTime() < 300) ? 128 : 8;
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads;
|
msgbuf << "Thread pool; current: " << alive << "; adjustment: " << tthreads;
|
||||||
@ -276,7 +281,7 @@ void ThreadPool::ManagerThreadProc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
msgbuf << "Pending tasks: " << pending << "; Average latency: "
|
msgbuf << "Pool #" << m_ID << ": Pending tasks: " << pending << "; Average latency: "
|
||||||
<< (long)(avg_latency * 1000) << "ms"
|
<< (long)(avg_latency * 1000) << "ms"
|
||||||
<< "; Max latency: " << (long)(max_latency * 1000) << "ms"
|
<< "; Max latency: " << (long)(max_latency * 1000) << "ms"
|
||||||
<< "; Threads: " << alive
|
<< "; Threads: " << alive
|
||||||
|
@ -73,7 +73,7 @@ private:
|
|||||||
static int m_NextID;
|
static int m_NextID;
|
||||||
|
|
||||||
boost::thread_group m_Threads;
|
boost::thread_group m_Threads;
|
||||||
ThreadStats m_ThreadStats[512];
|
ThreadStats m_ThreadStats[4096];
|
||||||
|
|
||||||
double m_WaitTime;
|
double m_WaitTime;
|
||||||
double m_ServiceTime;
|
double m_ServiceTime;
|
||||||
|
@ -108,7 +108,7 @@ void Service::UpdateNextCheck(void)
|
|||||||
|
|
||||||
double interval;
|
double interval;
|
||||||
|
|
||||||
if (GetStateType() == StateTypeSoft)
|
if (GetStateType() == StateTypeSoft && GetLastCheckResult() != NULL)
|
||||||
interval = GetRetryInterval();
|
interval = GetRetryInterval();
|
||||||
else
|
else
|
||||||
interval = GetCheckInterval();
|
interval = GetCheckInterval();
|
||||||
@ -459,6 +459,7 @@ void Service::ExecuteCheck(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* keep track of scheduling info in case the check type doesn't provide its own information */
|
/* 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();
|
double before_check = Utility::GetTime();
|
||||||
|
|
||||||
Service::Ptr self = GetSelf();
|
Service::Ptr self = GetSelf();
|
||||||
@ -490,16 +491,16 @@ void Service::ExecuteCheck(void)
|
|||||||
double after_check = Utility::GetTime();
|
double after_check = Utility::GetTime();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
if (!result->GetScheduleStart() == 0)
|
if (result->GetScheduleStart() == 0)
|
||||||
result->SetScheduleStart(before_check);
|
result->SetScheduleStart(scheduled_start);
|
||||||
|
|
||||||
if (!result->GetScheduleEnd() == 0)
|
if (result->GetScheduleEnd() == 0)
|
||||||
result->SetScheduleEnd(after_check);
|
result->SetScheduleEnd(after_check);
|
||||||
|
|
||||||
if (!result->GetExecutionStart() == 0)
|
if (result->GetExecutionStart() == 0)
|
||||||
result->SetExecutionStart(before_check);
|
result->SetExecutionStart(before_check);
|
||||||
|
|
||||||
if (!result->GetExecutionEnd() == 0)
|
if (result->GetExecutionEnd() == 0)
|
||||||
result->SetExecutionEnd(after_check);
|
result->SetExecutionEnd(after_check);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user