diff --git a/doc/7-configuring-icinga-2.md b/doc/7-configuring-icinga-2.md index 4412e324d..9089775e5 100644 --- a/doc/7-configuring-icinga-2.md +++ b/doc/7-configuring-icinga-2.md @@ -291,6 +291,7 @@ keys(dict) | Returns an array containing the dictionary's k string(value) | Converts the value to a string. number(value) | Converts the value to a number. bool(value) | Converts the value to a bool. +random() | Returns a random value between 0 and RAND_MAX (as defined in stdlib.h). log(value) | Writes a message to the log. Non-string values are converted to a JSON string. log(severity, facility, value) | Writes a message to the log. `severity` can be one of `LogDebug`, `LogNotice`, `LogInformation`, `LogWarning`, and `LogCritical`. Non-string values are converted to a JSON string. exit(integer) | Terminates the application. diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index cf654e542..8f8823d0b 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -41,6 +41,7 @@ REGISTER_SCRIPTFUNCTION(range, &ScriptUtils::Range); REGISTER_SCRIPTFUNCTION(exit, &ScriptUtils::Exit); REGISTER_SCRIPTFUNCTION(typeof, &ScriptUtils::TypeOf); REGISTER_SCRIPTFUNCTION(keys, &ScriptUtils::Keys); +REGISTER_SCRIPTFUNCTION(random, &Utility::Random); bool ScriptUtils::Regex(const String& pattern, const String& text) {