```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.os_type = "Linux/Unix"
null
<2> => regex("^Linux", host.vars.os_type)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.databases = [ "db-prod1", "db-prod2", "db-dev" ]
null
<2> => regex("^db-prod\\d+", host.vars.databases, MatchAny)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var name = "db-prod-sfo-657"
null
<2> => match("*prod-sfo*", name)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0-28)
+Icinga 2 (version: v2.11.0-28)
<1> => host.vars.application_types = [ "web-wp", "web-rt", "db-local" ]
null
<2> => match("web-*", host.vars.application_types, MatchAll)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.address = "192.168.56.101"
null
<2> => cidr_match("192.168.56.0/24", host.address)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.vhost_ips = [ "192.168.56.101", "192.168.56.102", "10.0.10.99" ]
null
<2> => cidr_match("192.168.56.0/24", host.vars.vhost_ips, MatchAll)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => range(5)
[ 0.000000, 1.000000, 2.000000, 3.000000, 4.000000 ]
<2> => range(2,4)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.groups = [ "linux-servers", "db-servers" ]
null
<2> => host.groups.len()
Example:
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var dev_notification_groups = [ "devs", "slack" ]
null
<2> => var host_notification_groups = [ "slack", "noc" ]
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var dev_notification_groups = [ "devs", "slack" ]
null
<2> => var host_notification_groups = [ "slack", "noc" ]
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => host.vars.disks["/"] = {}
null
<2> => host.vars.disks["/var"] = {}
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => 5.to_string()
"5"
<2> => false.to_string()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => number(false)
0.000000
<2> => number("78")
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => bool(1)
true
<2> => bool(0)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => random()
1263171996.000000
<2> => random()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => log(LogCritical, "Console", "First line")
critical/Console: First line
null
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => typeof(3) == Number
true
<2> => typeof("str") == String
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_time()
1480072135.633008
<2> => get_time()
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var pd = "'time'=1480074205.197363;;;"
null
<2> => parse_performance_data(pd)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => dirname(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => basename(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/scripts/xmpp-notification.pl"
null
<2> => path_exists(path)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var pathSpec = "/etc/icinga2/conf.d/*.conf"
null
<2> => glob(pathSpec)
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => var path = "/etc/icinga2/zones.d/"
null
<2> => var pattern = "*.conf"
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => escape_shell_arg("'$host.name$' '$service.name$'")
"''\\''$host.name$'\\'' '\\''$service.name$'\\'''"
```
```
$ icinga2 console
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => escape_shell_cmd("/bin/echo 'shell test' $ENV")
"/bin/echo 'shell test' \\$ENV"
```
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_service(NodeName, "disk")
<2> => get_service(NodeName, "disk").__name
```
$ ICINGA2_API_PASSWORD=icinga icinga2 console --connect 'https://root@localhost:5665/'
-Icinga 2 (version: v2.7.0)
+Icinga 2 (version: v2.11.0)
<1> => get_services(NodeName).map(s => s.name)
[ "disk", "disk /", "http", "icinga", "load", "ping4", "ping6", "procs", "ssh", "users" ]
```
var s = DateTime(2016, 4, 21).to_string() /* Sets s to "2016-04-21 00:00:00 +0200". */
-```
\ No newline at end of file
+```