Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/base/io-engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions lib/base/io-engine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class IoEngine

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.
Expand Down
4 changes: 3 additions & 1 deletion lib/methods/icingachecktask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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));
Expand Down
Loading