"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "doc/18-library-reference.md" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

18-library-reference.md  (icinga2-2.11.5):18-library-reference.md  (icinga2-2.12.0)
skipping to change at line 904 skipping to change at line 904
Signature: Signature:
``` ```
function get_objects(type); function get_objects(type);
``` ```
Returns an array of objects whose type matches the specified type. `type` must r efer Returns an array of objects whose type matches the specified type. `type` must r efer
to a type object. to a type object.
### get_template <a id="objref-get_template"></a>
Signature:
```
function get_template(type, name);
```
Returns the template with the specified type and name, or `null` if no such obje
ct exists. `type` must refer
to a type object.
> **Note**
>
> Only the name and debug info attributes are available for templates accessed i
n the DSL.
> Object attributes are not available in this scope.
You can use this functionality to check whether a template exists e.g. on a sate
llite endpoint
and if not, import a different template.
```
object Host "icinga-agent47.localdomain" {
if (get_template(Host, "master-host-tmpl")) {
import "master-host-tmpl"
} else {
import "generic-host"
}
}
```
### get_templates <a id="objref-get_templates"></a>
Signature:
```
function get_templates(type);
```
Returns an array of templates whose type matches the specified type. `type` must
refer
to a type object.
> **Note**
>
> Only the name and debug info attributes are available for templates accessed i
n the DSL.
> Object attributes are not available in this scope.
You can use this function to iterate over all available template names, similar
to what
the [templates API URL endpoint](12-icinga2-api.md#icinga2-api-config-templates)
provides.
```
<1> => get_templates(Host).map(n => n.name)
[ "ssh-agent" ]
```
## Math object <a id="math-object"></a> ## Math object <a id="math-object"></a>
The global `Math` object can be used to access a number of mathematical constant s The global `Math` object can be used to access a number of mathematical constant s
and functions. and functions.
### Math.E <a id="math-e"></a> ### Math.E <a id="math-e"></a>
Euler's constant. Euler's constant.
### Math.LN2 <a id="math-ln2"></a> ### Math.LN2 <a id="math-ln2"></a>
 End of changes. 1 change blocks. 
0 lines changed or deleted 60 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)