IcingaCheckTask: Add available I/O cpu semaphores as a perfdata

This commit is contained in:
Yonas Habteab 2024-11-20 14:58:44 +01:00
parent 4b884ea953
commit a323bb3c1c
3 changed files with 10 additions and 1 deletions

View File

@ -85,6 +85,11 @@ boost::asio::io_context& IoEngine::GetIoContext()
return m_IoContext;
}
int_fast32_t IoEngine::GetCpuSemaphore() const
{
return m_CpuBoundSemaphore;
}
IoEngine::IoEngine() : m_IoContext(), m_KeepAlive(boost::asio::make_work_guard(m_IoContext)), m_Threads(decltype(m_Threads)::size_type(Configuration::Concurrency * 2u)), m_AlreadyExpiredTimer(m_IoContext)
{
m_AlreadyExpiredTimer.expires_at(boost::posix_time::neg_infin);

View File

@ -83,6 +83,8 @@ public:
boost::asio::io_context& GetIoContext();
int_fast32_t GetCpuSemaphore() const;
static inline size_t GetCoroutineStackSize() {
#ifdef _WIN32
// Increase the stack size for Windows coroutines to prevent exception corruption.

View File

@ -9,7 +9,7 @@
#include "icinga/checkable.hpp"
#include "remote/apilistener.hpp"
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include "base/io-engine.hpp"
#include "base/utility.hpp"
#include "base/perfdatavalue.hpp"
#include "base/function.hpp"
@ -81,6 +81,8 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
perfdata->Add(new PerfdataValue("current_concurrent_checks", Checkable::CurrentConcurrentChecks.load()));
perfdata->Add(new PerfdataValue("remote_check_queue", ClusterEvents::GetCheckRequestQueueSize()));
perfdata->Add(new PerfdataValue("num_free_io_cpu_slots", IoEngine::Get().GetCpuSemaphore()));
CheckableCheckStatistics scs = CIB::CalculateServiceCheckStats();
perfdata->Add(new PerfdataValue("min_latency", scs.min_latency));