Closed sinky closed 4 years ago
Hello @sinky and thank you for reporting!
your configuration is invalid. Please try CheckCommand instead of just command.
Best, AK
Sorry i cannot change this. This config is generated by Icinga Director.
i've got this from the /icingaweb2/director/config/files
page
Please could you figure out where Icinga 2 stores this particular Director config...
grep -rnFwe 'object command' /var/lib/icinga2/api
... and change it temporarily?
The grep command get's no results, but the file /var/lib/icinga2/api/zones/director-global/director/commands.conf
contains the correct object CheckCommand
definitions. Possible a display bug in Icinga Director?
But back to the real issue. The service and it's CheckCommand work fine, except that the CheckCommand's timeout value isn't overridden by a timeout defined on service(template).
@Thomas-Gelf @lazyfrosch Does this work as intended?
Yeah this seems to be a UI rendering bug when displaying config files. The text config should be fine.
Why timeout is not working correctly needs to be tested.
I've whiteboxtested the code – everything seems clean. Very strange..
Just remembered: Icinga 2 adjusts the actual check execution times by random values to emulate actual scheduling of checks with equal execution times.
Please could you re-try with somewhat larger timeouts?
Initialy i‘ve used 30 Seconds on checkcommand and 60 seconds on the Service.
And it timed out After 30,xx second. But i can check it again on Monday if necessary.
Is it possible that the service timeout can only be lower than the timeout on the CheckCommand?
Yes, please re-check. I've both whiteboxtested and blackboxtested Icinga and it works for me on MacOS (the code is the same across all OSes):
object CheckCommand "timeout30" {
import "plugin-check-command"
command = [ "sleep", "35" ]
timeout = 30
}
object Host NodeName {
check_command = "hostalive"
enable_active_checks = false
}
object Service "timeout60" {
host_name = NodeName
check_command = "timeout30"
check_timeout = 60
}
check_timeout
overrides the timeout
variable of a CheckCommand object upon direct execution prior to spawning a check process. https://github.com/Icinga/icinga2/blob/master/lib/methods/pluginchecktask.cpp#L38
One thing which comes to mind - this is for local execution only, and not passed via command endpoint checks to my knowledge. In order to reproduce the issue, one explicitly needs a remote command endpoint check then possibly with a sleep command, and a lower timeout defined.
Additional info: command_endpoint checks use a virtual checkable host
object on the agent where check_timeout
isn't set at all. There is no service object available on the remote end.
@dnsmichi Shouldn't we let one component do both jobs not to have to adjust two of them every time?
Note: The Director (master) shows the commands as expected.
check_timeout
was invented to allow specific timeout overrides coming from the host/service object. The CheckCommand's timeout
attribute cannot be easily overridden otherwise. That's the culprit here, as the CheckCommand exists on the remote host, but not the host/service object itself.
The patch shouldn't be that hard, but it involves changed cluster messages and as such it only qualifies for 2.11+.
Cheers, Michael
With the following config (generated by director), the Service-Check
services
timed out after10s
and not after15s
as expected. (on Windows)Expected Behavior
Service-Check should timeout after
15s
As described here https://icinga.com/docs/icinga2/latest/doc/09-object-types/#service at Configuration Attributecheck_timeout
Current Behavior
Service-Check should timeout after
10s
Steps to Reproduce (for bugs)
Create a CheckCommand with a
timeout
of10s
Create a ServiceTemplate with acheck_timeout
of15s
Your Environment
icinga2 --version
): r2.10.2-1