mirror of https://github.com/Icinga/icinga2.git
parent
b968850bc1
commit
25dc86881a
|
@ -32,7 +32,7 @@ Icinga 2's init script is installed in `/etc/init.d/icinga2` by default:
|
||||||
-V [ --version ] show version information
|
-V [ --version ] show version information
|
||||||
-l [ --library ] arg load a library
|
-l [ --library ] arg load a library
|
||||||
-I [ --include ] arg add include search directory
|
-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 [ --config ] arg parse a configuration file
|
||||||
-C [ --validate ] exit after validating the configuration
|
-C [ --validate ] exit after validating the configuration
|
||||||
-x [ --debug ] enable debugging
|
-x [ --debug ] enable debugging
|
||||||
|
@ -50,9 +50,9 @@ Icinga 2's init script is installed in `/etc/init.d/icinga2` by default:
|
||||||
Instead of loading libraries using the [`library` config directive](#library)
|
Instead of loading libraries using the [`library` config directive](#library)
|
||||||
you can also use the `--library` command-line option.
|
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
|
#### Config Include Path
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
> **Note**
|
> **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`.
|
> also partly overridden such as `IcingaEnableChecks`.
|
||||||
|
|
||||||
### <a id="runtime-macros"></a> Runtime Macros
|
### <a id="runtime-macros"></a> Runtime Macros
|
||||||
|
@ -64,7 +64,7 @@ up macros:
|
||||||
2. Service object
|
2. Service object
|
||||||
3. Host object
|
3. Host object
|
||||||
4. Command 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
|
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
|
command objects. The `my-ping` command shown above uses this to set default
|
||||||
|
@ -262,7 +262,7 @@ when passing credentials to database checks:
|
||||||
|
|
||||||
### <a id="configuration-macros"></a> Configuration Macros
|
### <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
|
scope. For example, constant expressions can reference a pre-defined global constant
|
||||||
variable and calculate a value for the service check interval.
|
variable and calculate a value for the service check interval.
|
||||||
|
|
||||||
|
@ -276,4 +276,4 @@ Example:
|
||||||
check_interval = (MyCheckInterval / 2.5)
|
check_interval = (MyCheckInterval / 2.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
More details in the chapter [Constant Expressions](#constant-expressions).
|
More details in the chapter [Constant Expressions](#constant-expressions).
|
||||||
|
|
|
@ -296,21 +296,20 @@ dictionary by exiplicitely overriding their value with `null`.
|
||||||
services["ping6"] = null
|
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.
|
The value can be a string, number, array or a dictionary.
|
||||||
|
|
||||||
Variables can be set multiple times unless they were introduced using
|
Constants cannot be changed once they are set.
|
||||||
the `const` keyword.
|
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
>
|
>
|
||||||
> The `set` keyword is an alias for the `var` keyword and is available
|
> The `set` and `var` keywords are an alias for `const` and are available
|
||||||
> in order to provide compatibility with older versions. Its use is
|
> in order to provide compatibility with older versions. Their use is
|
||||||
> deprecated.
|
> deprecated.
|
||||||
|
|
||||||
### <a id="constant-expressions"></a> Constant Expressions
|
### <a id="constant-expressions"></a> Constant Expressions
|
||||||
|
@ -328,7 +327,7 @@ overridden by grouping expressions using parentheses:
|
||||||
check_interval ((15 * 60) / 2)
|
check_interval ((15 * 60) / 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Global variables may be used in constant expressions.
|
Global constants may be used in constant expressions.
|
||||||
|
|
||||||
var MyCheckInterval = 10m
|
var MyCheckInterval = 10m
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
## <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
|
Variable |Description
|
||||||
--------------------------|-------------------
|
--------------------------|-------------------
|
||||||
|
|
|
@ -209,7 +209,7 @@ int main(int argc, char **argv)
|
||||||
("version,V", "show version information")
|
("version,V", "show version information")
|
||||||
("library,l", po::value<std::vector<String> >(), "load a library")
|
("library,l", po::value<std::vector<String> >(), "load a library")
|
||||||
("include,I", po::value<std::vector<String> >(), "add include search directory")
|
("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")
|
("config,c", po::value<std::vector<String> >(), "parse a configuration file")
|
||||||
("no-config,z", "start without a configuration file")
|
("no-config,z", "start without a configuration file")
|
||||||
("validate,C", "exit after validating the configuration")
|
("validate,C", "exit after validating the configuration")
|
||||||
|
|
|
@ -203,9 +203,7 @@ variable: variable_decl identifier T_EQUAL value
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptVariable::Ptr sv = ScriptVariable::Set($2, *value);
|
ScriptVariable::Ptr sv = ScriptVariable::Set($2, *value);
|
||||||
|
sv->SetConstant(true);
|
||||||
if (!$1)
|
|
||||||
sv->SetConstant(true);
|
|
||||||
|
|
||||||
free($2);
|
free($2);
|
||||||
delete value;
|
delete value;
|
||||||
|
|
Loading…
Reference in New Issue