Skip to content

Commit

Permalink
Implement support for overriding check command timeout
Browse files Browse the repository at this point in the history
fixes #9283
  • Loading branch information
Michael Friedrich committed Apr 7, 2016
1 parent d2f5008 commit 2b2e250
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/6-object-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ Configuration Attributes:
check\_command |**Required.** The name of the check command.
max\_check\_attempts|**Optional.** The number of times a host is re-checked before changing into a hard state. Defaults to 3.
check\_period |**Optional.** The name of a time period which determines when this host should be checked. Not set by default.
check\_timeout |**Optional.** Check command timeout in seconds. Overrides the CheckCommand's `timeout` attribute.
check\_interval |**Optional.** The check interval (in seconds). This interval is used for checks when the host is in a `HARD` state. Defaults to 5 minutes.
retry\_interval |**Optional.** The retry interval (in seconds). This interval is used for checks when the host is in a `SOFT` state. Defaults to 1 minute.
enable\_notifications|**Optional.** Whether notifications are enabled. Defaults to true.
Expand Down Expand Up @@ -1158,6 +1159,7 @@ Configuration Attributes:
check\_command |**Required.** The name of the check command.
max\_check\_attempts|**Optional.** The number of times a service is re-checked before changing into a hard state. Defaults to 3.
check\_period |**Optional.** The name of a time period which determines when this service should be checked. Not set by default.
check\_timeout |**Optional.** Check command timeout in seconds. Overrides the CheckCommand's `timeout` attribute.
check\_interval |**Optional.** The check interval (in seconds). This interval is used for checks when the service is in a `HARD` state. Defaults to 5 minutes.
retry\_interval |**Optional.** The retry interval (in seconds). This interval is used for checks when the service is in a `SOFT` state. Defaults to 1 minute.
enable\_notifications|**Optional.** Whether notifications are enabled. Defaults to true.
Expand Down
1 change: 1 addition & 0 deletions lib/icinga/checkable.ti
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ abstract class Checkable : CustomVarObject
return TimePeriod::GetByName(GetCheckPeriodRaw());
}}}
};
[config] Value check_timeout;
[config] double check_interval {
default {{{ return 5 * 60; }}}
};
Expand Down
7 changes: 6 additions & 1 deletion lib/icinga/pluginutility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ void PluginUtility::ExecuteCommand(const Command::Ptr& commandObj, const Checkab
return;

Process::Ptr process = new Process(Process::PrepareCommand(command), envMacros);
process->SetTimeout(commandObj->GetTimeout());

if (checkable->GetCheckTimeout().IsEmpty())
process->SetTimeout(commandObj->GetTimeout());
else
process->SetTimeout(checkable->GetCheckTimeout());

process->Run(boost::bind(callback, command, _1));
}

Expand Down

0 comments on commit 2b2e250

Please sign in to comment.