From 766e28e1aa3774fef2000c855d7c5ca090f2d4d0 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 15 Jun 2023 12:29:42 +0200 Subject: [PATCH] IcingaDB::PrepareObject(): convert non-null Checkable#check_timeout to number and, in case of null, fall back to Checkable#check_command.timeout, just like IcingaDB#SerializeState(). Otherwise the Go daemon crashes. It expects a number. --- lib/icingadb/icingadb-objects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 6e39ec0cf..9693a1ce0 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -1272,10 +1272,11 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a if (type == Host::TypeInstance || type == Service::TypeInstance) { Checkable::Ptr checkable = static_pointer_cast(object); + auto checkTimeout (checkable->GetCheckTimeout()); attributes->Set("checkcommand_name", checkable->GetCheckCommand()->GetName()); attributes->Set("max_check_attempts", checkable->GetMaxCheckAttempts()); - attributes->Set("check_timeout", checkable->GetCheckTimeout()); + attributes->Set("check_timeout", checkTimeout.IsEmpty() ? checkable->GetCheckCommand()->GetTimeout() : (double)checkTimeout); attributes->Set("check_interval", checkable->GetCheckInterval()); attributes->Set("check_retry_interval", checkable->GetRetryInterval()); attributes->Set("active_checks_enabled", checkable->GetEnableActiveChecks());