Advanced use of dictionary (oracle)

Hi,

I’d advise checking the docs which explain the apply for loop unrolling first.

config is the loop iterator’s value and contains the sub keys from your nested dictionary.

  vars.plugin_user = config.oracle_health_username

Although I’d recommend to just use oracle_health as CheckCommand, where the generic

vars += config

is sufficient. In the long run, this could be written as "copy every key-value pair from config into vars.
Specifically, this does the following in your example:

vars.oracle_health_username = config.oracle_health_username
vars.oracle_health_password = config.oracle_health_password

Also, I’d suggest storing the passwords in constants, and assign them into host templates, hidden from the actual host object.

If you want to go into deeper nesting of your database dictionaries, check this howto I had written in the past.

Cheers,
Michael

1 Like