# Advanced use of dictionary (oracle)

**URL:** <https://community.icinga.com/t/advanced-use-of-dictionary-oracle/3335>\
**Category:** Service Monitoring\
**Created:** [January 28, 2020, 4:34pm UTC](https://community.icinga.com/t/advanced-use-of-dictionary-oracle/3335 "2020-01-28T16:34:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [January 28, 2020, 6:04pm UTC](https://community.icinga.com/t/advanced-use-of-dictionary-oracle/3335/2 "2020-01-28T18:04:30Z")

</div>

Hi,

I’d advise checking the [docs](https://icinga.com/docs/icinga2/latest/doc/03-monitoring-basics/#apply-for-and-custom-variable-override) which explain the apply for loop unrolling first.

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

```auto
  vars.plugin_user = config.oracle_health_username

```

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

```auto
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:

```auto
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](https://community.icinga.com/t/dsl-flatten-a-nested-dictionary-with-a-function-for-apply-for-rules/1330) I had written in the past.

Cheers,  
Michael

---

_[View the full topic](https://community.icinga.com/t/advanced-use-of-dictionary-oracle/3335)._
