Am 14.04.2015 um 22:43 schrieb Dustin Funk:

Hi,

it is solved.

Am 14.04.2015 um 01:15 schrieb Dustin Funk:


Hi,

i've a problem with resolving macros in dictionary definitions. I'll
resolve $address$ in 'vars.dns["dns server"]' but the front-end shows
$address$ instead the IP.

Anybody knows if

- my config is wrong
- my macro call is wrong
- the icinga2 parser doesn't resolve macros at this place




My opinion is that the parser can't resolve that.




icinga-2.3.3:

object Host "name" {
 import "generic-host"
 address = "111.222.333.444"

 vars.dns["dns server"] = {
       dns_lookup = "$address$"
       dns_server = "www.fem.tu-ilmenau.de<http://www.fem.tu-ilmenau.de>"
 }
}

apply Service "dns" for (dns_name => config in host.vars.dns) {
 import "generic-service"
 vars += config

 display_name = dns_name
 check_command = "dns"

 assign where host.vars.dns
}




The solution we evaluate is to move the variable/macro call in the appy
rule.

qpply Service "dns" for (dns_name => config in host.vars.dns) {
 import "generic-service"
 vars += config

 display_name = dns_name
 check_command = "dns"

 if (vars.dns_lookup) {
       vars.dns_lookup = vars.dns_lookup

That doesn't work - it requires the scope (host).


       vars.dns_lookup = host.vars.dns_lookup



 } else {
       vars.dns_lookup = host.address
 }
 if (vars.dns_server) {
       vars.dns_server = vars.dns_server
 } else {
       vars.dns_server = host.address
 }
 assign where host.vars.dns
}

I think i can save a few lines when i negotiate the condition and delete
the duplicated vars-definitions.

Kindly regards,
 nuts





_______________________________________________
icinga-users mailing list
[email protected]<mailto:[email protected]>
https://lists.icinga.org/mailman/listinfo/icinga-users



-- 
Michael Friedrich, DI (FH)
Application Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]

** OSDC 2015 - April - osdc.de **
** Puppet Camp Berlin 2015 - April - netways.de/puppetcamp **
** OSBConf 2015 - September - osbconf.org **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to