diff --git a/lib/icinga/icinga-type.conf b/lib/icinga/icinga-type.conf index 32d674979..37179d212 100644 --- a/lib/icinga/icinga-type.conf +++ b/lib/icinga/icinga-type.conf @@ -50,6 +50,8 @@ type Host { %attribute string "*" }, + %attribute name(CheckCommand) "check_command", + %attribute name(TimePeriod) "check_period", %attribute number "check_interval", %attribute number "retry_interval", @@ -331,4 +333,4 @@ type NotificationCommand inherits Command { type EventCommand inherits Command { -} \ No newline at end of file +} diff --git a/lib/icinga/service-check.cpp b/lib/icinga/service-check.cpp index 71361c9db..ff787b827 100644 --- a/lib/icinga/service-check.cpp +++ b/lib/icinga/service-check.cpp @@ -582,7 +582,12 @@ void Service::ExecuteCheck(void) Dictionary::Ptr result; try { - result = GetCheckCommand()->Execute(GetSelf()); + CheckCommand::Ptr command = GetCheckCommand(); + + if (!command) + return; + + result = command->Execute(GetSelf()); } catch (const std::exception& ex) { std::ostringstream msgbuf; msgbuf << "Exception occured during check for service '"