diff --git a/doc/17-library-reference.md b/doc/17-library-reference.md index 82e54e2a7..aca1c767e 100644 --- a/doc/17-library-reference.md +++ b/doc/17-library-reference.md @@ -99,6 +99,15 @@ Signature: Returns the UserGroup object with the specified name, or `null` if no such UserGroup object exists. +### get_time_period + +Signature: + + function get_time_period(name); + +Returns the TimePeriod object with the specified name, or `null` if no such TimePeriod object exists. + + ### get_object Signature: diff --git a/lib/icinga/objectutils.cpp b/lib/icinga/objectutils.cpp index 844dc2b93..a10baeeeb 100644 --- a/lib/icinga/objectutils.cpp +++ b/lib/icinga/objectutils.cpp @@ -38,6 +38,7 @@ REGISTER_SCRIPTFUNCTION(get_notification_command, &NotificationCommand::GetByNam REGISTER_SCRIPTFUNCTION(get_host_group, &HostGroup::GetByName); REGISTER_SCRIPTFUNCTION(get_service_group, &ServiceGroup::GetByName); REGISTER_SCRIPTFUNCTION(get_user_group, &UserGroup::GetByName); +REGISTER_SCRIPTFUNCTION(get_time_period, &TimePeriod::GetByName); Service::Ptr ObjectUtils::GetService(const String& host, const String& name) {