Host and service check specific timeouts#525
Merged
sni merged 8 commits intonaemon:masterfrom Feb 28, 2026
Merged
Conversation
added 6 commits
February 24, 2026 16:47
the constructor assigns the global timeouts, which gets overwritten by the config parser if 'check_timeout' is given
… initialize them to 0 anymore. logically the timeout cannot be 0
sni
approved these changes
Feb 26, 2026
Contributor
|
Looks good. Could you please have a look at the failed test case. Probably just missing the new values. Also it would be nice to add a Changelog entry in the NEWS file and also adding the new attribute to the docs on the website. |
added 2 commits
February 27, 2026 10:09
add check_timeout field to service and host definitions
mention host / service check timeout overrides
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds timeout overrides to host/service checks.
Previously, host and service checks each used a global timeout. Users could not change this timeout per host or (more likely) per service. The defaults were 30 seconds for host timeouts and 60 seconds for service timeouts.
Add a field to host/service definitions named 'check_timeout' , which is used as an override.
src/naemon/xodtemplate.h/c
add field 'check_timeout' & 'have_check_timeout' to xodtemplate_host_struct & xodtemplate_service_struct
xodtemplate_begin_object_definition is used to construct the template , set check_timeout to the global host/service timeout values by default.
src/naemon/objects_service.h/c and object_host
add field 'check_timeout' to the service definition, and add the accompanying 'has_check_timeout' that other fields have. Do not exactly understand what it is for, and do not access it in the rest of the PR.
print 'check_timeout' on the fcache_service/host as well
src/naemon/checks.h
add field 'timeout' to the check_result. This is not necessarily needed for logic, but I think that is a good addition for two reasons:
First, it already has a flag 'early_timeout' that will be set if the check timed out.
update_host_state_post_checkfunction checks if it timed out, but not with which value.Second, the timeout used might have custom values now. It does not necessarily have to be either of the two global values: service_check_timeout / host_check_timeout. It can be directly saved as a value, taken from a template or a macro etc.
check_result is used in
handle_async(host|service)_check_resultfunctions for thebroker_(host|service)_checkfunctions, directly getting the saved timeout from check_result might be useful for some use cases. Maybe thruk can use it somehow? @snisrc/naemon/check_host / service
on the
run_async_(host|service)_checkinstead of using the global values, just use the check_timeout from the service/host check now. Does not matter if it was unchanged or not after it was initialized with the global value.there is also a check_for_orphaned_hosts handler, where the timeout has to be determined again during iteration of all hosts.
src/naemon/commands.c > service_command_handler
no changes here. not registering any commands here to change check_timeout dynamically.
src/naemon/xrddefault.c > xrddefault_read_state_information
no changes here either. this is responsible for printing modified attributes, and we do not modify check_timeout during runtime with a service command
For maintainers:
I can sign the comments if necessary. Please quash before merging.