mirror of https://github.com/Icinga/icinga2.git
Correct current_concurrent_checks to actually running checks
refs #7416
This commit is contained in:
parent
c2e1d023e2
commit
efc7f2cf8d
|
@ -23,6 +23,8 @@ boost::signals2::signal<void (const Checkable::Ptr&, const CheckResult::Ptr&, st
|
|||
boost::signals2::signal<void (const Checkable::Ptr&, NotificationType, const CheckResult::Ptr&, const String&, const String&, const MessageOrigin::Ptr&)> Checkable::OnNotificationsRequested;
|
||||
boost::signals2::signal<void (const Checkable::Ptr&)> Checkable::OnNextCheckUpdated;
|
||||
|
||||
Atomic<uint_fast64_t> Checkable::CurrentConcurrentChecks (0);
|
||||
|
||||
boost::mutex Checkable::m_StatsMutex;
|
||||
int Checkable::m_PendingChecks = 0;
|
||||
boost::condition_variable Checkable::m_PendingChecksCV;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#ifndef CHECKABLE_H
|
||||
#define CHECKABLE_H
|
||||
|
||||
#include "base/atomic.hpp"
|
||||
#include "base/timer.hpp"
|
||||
#include "icinga/i2-icinga.hpp"
|
||||
#include "icinga/checkable-ti.hpp"
|
||||
|
@ -12,6 +13,7 @@
|
|||
#include "icinga/downtime.hpp"
|
||||
#include "remote/endpoint.hpp"
|
||||
#include "remote/messageorigin.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
namespace icinga
|
||||
{
|
||||
|
@ -131,6 +133,8 @@ public:
|
|||
static boost::signals2::signal<void (const Checkable::Ptr&)> OnNextCheckUpdated;
|
||||
static boost::signals2::signal<void (const Checkable::Ptr&)> OnEventCommandExecuted;
|
||||
|
||||
static Atomic<uint_fast64_t> CurrentConcurrentChecks;
|
||||
|
||||
/* Downtimes */
|
||||
int GetDowntimeDepth() const final;
|
||||
|
||||
|
|
|
@ -292,8 +292,8 @@ void CIB::StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata) {
|
|||
|
||||
// Checker related stats
|
||||
status->Set("remote_check_queue", ClusterEvents::GetCheckRequestQueueSize());
|
||||
status->Set("current_concurrent_checks", Checkable::GetPendingChecks());
|
||||
status->Set("current_pending_callbacks", Application::GetTP().GetPending());
|
||||
status->Set("current_concurrent_checks", Checkable::CurrentConcurrentChecks.load());
|
||||
|
||||
CheckableCheckStatistics scs = CalculateServiceCheckStats();
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void IcingaCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
perfdata->Add(new PerfdataValue("passive_service_checks_15min", CIB::GetPassiveServiceChecksStatistics(60 * 15)));
|
||||
|
||||
perfdata->Add(new PerfdataValue("current_pending_callbacks", Application::GetTP().GetPending()));
|
||||
perfdata->Add(new PerfdataValue("current_concurrent_checks", Checkable::GetPendingChecks()));
|
||||
perfdata->Add(new PerfdataValue("current_concurrent_checks", Checkable::CurrentConcurrentChecks.load()));
|
||||
perfdata->Add(new PerfdataValue("remote_check_queue", ClusterEvents::GetCheckRequestQueueSize()));
|
||||
|
||||
CheckableCheckStatistics scs = CIB::CalculateServiceCheckStats();
|
||||
|
|
|
@ -44,12 +44,15 @@ void PluginCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckRes
|
|||
resolvers, resolvedMacros, useResolvedMacros, timeout,
|
||||
std::bind(&PluginCheckTask::ProcessFinishedHandler, checkable, cr, _1, _2));
|
||||
|
||||
if (!resolvedMacros || useResolvedMacros)
|
||||
if (!resolvedMacros || useResolvedMacros) {
|
||||
Checkable::CurrentConcurrentChecks.fetch_add(1);
|
||||
Checkable::IncreasePendingChecks();
|
||||
}
|
||||
}
|
||||
|
||||
void PluginCheckTask::ProcessFinishedHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const Value& commandLine, const ProcessResult& pr)
|
||||
{
|
||||
Checkable::CurrentConcurrentChecks.fetch_sub(1);
|
||||
Checkable::DecreasePendingChecks();
|
||||
|
||||
if (pr.ExitStatus > 3) {
|
||||
|
|
Loading…
Reference in New Issue