Merge pull request #10443 from Icinga/use-correct-timeout-for-command-endpoints

Checkable: Use correct timeout for rescheduling remote checks
This commit is contained in:
Yonas Habteab 2025-05-23 10:14:49 +02:00 committed by GitHub
commit 2b0f73987e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -623,12 +623,16 @@ void Checkable::ExecuteCheck()
if (service) if (service)
params->Set("service", service->GetShortName()); params->Set("service", service->GetShortName());
double checkTimeout = GetCheckCommand()->GetTimeout();
/* /*
* If the host/service object specifies the 'check_timeout' attribute, * If the host/service object specifies the 'check_timeout' attribute,
* forward this to the remote endpoint to limit the command execution time. * forward this to the remote endpoint to limit the command execution time.
*/ */
if (!GetCheckTimeout().IsEmpty()) if (auto ckCheckTimeout(GetCheckTimeout()); !ckCheckTimeout.IsEmpty()) {
params->Set("check_timeout", GetCheckTimeout()); checkTimeout = Convert::ToDouble(ckCheckTimeout);
params->Set("check_timeout", ckCheckTimeout);
}
params->Set("macros", macros); params->Set("macros", macros);
@ -641,7 +645,7 @@ void Checkable::ExecuteCheck()
* a check result from the remote instance. The check will be re-scheduled * a check result from the remote instance. The check will be re-scheduled
* using the proper check interval once we've received a check result. * using the proper check interval once we've received a check result.
*/ */
SetNextCheck(Utility::GetTime() + GetCheckCommand()->GetTimeout() + 30); SetNextCheck(Utility::GetTime() + checkTimeout + 30);
/* /*
* Let the user know that there was a problem with the check if * Let the user know that there was a problem with the check if