From 71c0b96d378f29c1ae35c941252caa6baa3ca541 Mon Sep 17 00:00:00 2001 From: William Calliari <42240136+w1ll-i-code@users.noreply.github.com> Date: Fri, 15 Nov 2024 17:26:00 +0100 Subject: [PATCH 1/3] Adjust activation_priority for key config objects Make sure all configobjects are started and shut down in an order, such that all state changes of monitoring objects are correctly processed during the shutdown. --- lib/base/configobject.cpp | 6 +++--- lib/checker/checkercomponent.cpp | 4 ++++ lib/db_ido_mysql/idomysqlconnection.ti | 2 +- lib/db_ido_pgsql/idopgsqlconnection.ti | 2 +- lib/icinga/notification.ti | 2 ++ lib/icinga/user.ti | 2 ++ lib/icingadb/icingadb.ti | 2 +- lib/notification/notificationcomponent.ti | 2 +- 8 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/base/configobject.cpp b/lib/base/configobject.cpp index 4317771d1f8..a86d1884583 100644 --- a/lib/base/configobject.cpp +++ b/lib/base/configobject.cpp @@ -598,10 +598,10 @@ void ConfigObject::StopObjects() continue; for (const ConfigObject::Ptr& object : dtype->GetObjects()) { -#ifdef I2_DEBUG Log(LogDebug, "ConfigObject") - << "Deactivate() called for config object '" << object->GetName() << "' with type '" << type->GetName() << "'."; -#endif /* I2_DEBUG */ + << "Deactivate() called for config object '" << object->GetName() + << "' with type '" << type->GetName() + << "and priority " << type->GetActivationPriority() << "'."; object->Deactivate(); } } diff --git a/lib/checker/checkercomponent.cpp b/lib/checker/checkercomponent.cpp index d92101f4ea5..6665f6ea90e 100644 --- a/lib/checker/checkercomponent.cpp +++ b/lib/checker/checkercomponent.cpp @@ -78,6 +78,10 @@ void CheckerComponent::Stop(bool runtimeRemoved) { std::unique_lock lock(m_Mutex); m_Stopped = true; + if (!runtimeRemoved) { + m_IdleCheckables.clear(); + m_PendingCheckables.clear(); + } m_CV.notify_all(); } diff --git a/lib/db_ido_mysql/idomysqlconnection.ti b/lib/db_ido_mysql/idomysqlconnection.ti index 681148fb3bb..1ddc36608b0 100644 --- a/lib/db_ido_mysql/idomysqlconnection.ti +++ b/lib/db_ido_mysql/idomysqlconnection.ti @@ -9,7 +9,7 @@ namespace icinga class IdoMysqlConnection : DbConnection { - activation_priority 100; + activation_priority -50; [config] String host { default {{{ return "localhost"; }}} diff --git a/lib/db_ido_pgsql/idopgsqlconnection.ti b/lib/db_ido_pgsql/idopgsqlconnection.ti index bc4deffd689..7c98e643c34 100644 --- a/lib/db_ido_pgsql/idopgsqlconnection.ti +++ b/lib/db_ido_pgsql/idopgsqlconnection.ti @@ -9,7 +9,7 @@ namespace icinga class IdoPgsqlConnection : DbConnection { - activation_priority 100; + activation_priority -50; [config] String host { default {{{ return "localhost"; }}} diff --git a/lib/icinga/notification.ti b/lib/icinga/notification.ti index be0784613e8..4d1e953931f 100644 --- a/lib/icinga/notification.ti +++ b/lib/icinga/notification.ti @@ -20,6 +20,8 @@ public: class Notification : CustomVarObject < NotificationNameComposer { + activation_priority -5; + load_after Host; load_after Service; diff --git a/lib/icinga/user.ti b/lib/icinga/user.ti index 8b8c43a14d4..7b00a344f50 100644 --- a/lib/icinga/user.ti +++ b/lib/icinga/user.ti @@ -11,6 +11,8 @@ namespace icinga class User : CustomVarObject { + activation_priority -10; + [config] String display_name { get {{{ String displayName = m_DisplayName.load(); diff --git a/lib/icingadb/icingadb.ti b/lib/icingadb/icingadb.ti index 1c649c8e455..8e25bf4438a 100644 --- a/lib/icingadb/icingadb.ti +++ b/lib/icingadb/icingadb.ti @@ -10,7 +10,7 @@ namespace icinga class IcingaDB : ConfigObject { - activation_priority 100; + activation_priority -50; [config] String host { default {{{ return "127.0.0.1"; }}} diff --git a/lib/notification/notificationcomponent.ti b/lib/notification/notificationcomponent.ti index 13af136918a..257cf46710b 100644 --- a/lib/notification/notificationcomponent.ti +++ b/lib/notification/notificationcomponent.ti @@ -9,7 +9,7 @@ namespace icinga class NotificationComponent : ConfigObject { - activation_priority 200; + activation_priority -25; [config] bool enable_ha (EnableHA) { default {{{ return true; }}} From 4a39831ead9527566e2a0cb186407b4117129477 Mon Sep 17 00:00:00 2001 From: William Calliari <42240136+w1ll-i-code@users.noreply.github.com> Date: Tue, 12 Nov 2024 11:43:52 +0100 Subject: [PATCH 2/3] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 91aa3738240..68c2192f9f8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -295,6 +295,7 @@ vigiroux Vytenis Darulis Wenger Florian Will Frey +William Calliari Winfried Angele Wolfgang Nieder XnS From 39977d98d88119d08578130a9f2828153d8749f0 Mon Sep 17 00:00:00 2001 From: William Calliari <42240136+w1ll-i-code@users.noreply.github.com> Date: Thu, 21 Nov 2024 08:55:24 +0100 Subject: [PATCH 3/3] Activate users and notifications at the same time. --- lib/icinga/user.ti | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/icinga/user.ti b/lib/icinga/user.ti index 7b00a344f50..b7da24ab9a7 100644 --- a/lib/icinga/user.ti +++ b/lib/icinga/user.ti @@ -11,7 +11,7 @@ namespace icinga class User : CustomVarObject { - activation_priority -10; + activation_priority -5; [config] String display_name { get {{{