-V [ --version ] show version information
-l [ --library ] arg load a library
-I [ --include ] arg add include search directory
- -D [ --define] args define a variable
+ -D [ --define] args define a constant
-c [ --config ] arg parse a configuration file
-C [ --validate ] exit after validating the configuration
-x [ --debug ] enable debugging
Instead of loading libraries using the [`library` config directive](#library)
you can also use the `--library` command-line option.
-#### Variables
+#### Constants
-[Global variables](#global-variables) can be set using the `--define` command-line option.
+[Global constants](#global-constants) can be set using the `--define` command-line option.
#### Config Include Path
> **Note**
>
-> There is a limited set of special [global variables](#global-variables) which can be re-used and
+> There is a limited set of special [global constants](#global-constants) which can be re-used and
> also partly overridden such as `IcingaEnableChecks`.
### <a id="runtime-macros"></a> Runtime Macros
2. Service object
3. Host object
4. Command object
-5. Global macros in the IcingaMacros variable
+5. Global macros in the IcingaMacros constant
This execution order allows you to define default values for macros in your
command objects. The `my-ping` command shown above uses this to set default
### <a id="configuration-macros"></a> Configuration Macros
-Icinga 2 allows you to define constant variables which can be used in a limited
+Icinga 2 allows you to define constants which can be used in a limited
scope. For example, constant expressions can reference a pre-defined global constant
variable and calculate a value for the service check interval.
check_interval = (MyCheckInterval / 2.5)
}
-More details in the chapter [Constant Expressions](#constant-expressions).
\ No newline at end of file
+More details in the chapter [Constant Expressions](#constant-expressions).
services["ping6"] = null
-### <a id="variables"></a> Variables
+### <a id="constants"></a> Constants
-Global variables can be set using the `var` and `const` keywords:
+Global constants can be set using the `const` keyword:
- var VarName = "some value"
+ const VarName = "some value"
The value can be a string, number, array or a dictionary.
-Variables can be set multiple times unless they were introduced using
-the `const` keyword.
+Constants cannot be changed once they are set.
> **Note**
>
-> The `set` keyword is an alias for the `var` keyword and is available
-> in order to provide compatibility with older versions. Its use is
+> The `set` and `var` keywords are an alias for `const` and are available
+> in order to provide compatibility with older versions. Their use is
> deprecated.
### <a id="constant-expressions"></a> Constant Expressions
check_interval ((15 * 60) / 2)
}
-Global variables may be used in constant expressions.
+Global constants may be used in constant expressions.
var MyCheckInterval = 10m
-## <a id="global-variables"></a> Global Variables
+## <a id="global-constants"></a> Global Constants
-Icinga 2 provides a number of special global variables:
+Icinga 2 provides a number of special global constants. Some of them can be overriden using the `--define` command line parameter:
Variable |Description
--------------------------|-------------------
("version,V", "show version information")
("library,l", po::value<std::vector<String> >(), "load a library")
("include,I", po::value<std::vector<String> >(), "add include search directory")
- ("define,D", po::value<std::vector<String> >(), "define a variable")
+ ("define,D", po::value<std::vector<String> >(), "define a constant")
("config,c", po::value<std::vector<String> >(), "parse a configuration file")
("no-config,z", "start without a configuration file")
("validate,C", "exit after validating the configuration")
}
ScriptVariable::Ptr sv = ScriptVariable::Set($2, *value);
-
- if (!$1)
- sv->SetConstant(true);
+ sv->SetConstant(true);
free($2);
delete value;