# Usage of dictionaries for oracle\_health and tablespace\_usage

**URL:** <https://community.icinga.com/t/usage-of-dictionaries-for-oracle-health-and-tablespace-usage/1859>\
**Category:** Service Monitoring\
**Created:** [August 1, 2019, 3:33pm UTC](https://community.icinga.com/t/usage-of-dictionaries-for-oracle-health-and-tablespace-usage/1859 "2019-08-01T15:33:39Z")\
**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:** [August 1, 2019, 4:19pm UTC](https://community.icinga.com/t/usage-of-dictionaries-for-oracle-health-and-tablespace-usage/1859/2 "2019-08-01T16:19:33Z")

</div>

Hi,

```auto
  vars.oracle_health["tablespace-usage"] = {
    oracle_health_name = ["SYSTEM", "USERS"]
  }

```

creates a nested condition - you want services for

- tablespace-usage with SYSTEM
- tablespace-usage with USERS

The current apply for look only names `tablespace-usage` as loop key, and doesn’t know how to access the inner additional tablespace names.

There’s two solutions for this:

Either you create unique key-names inside the host object for `vars.oracle_health`, like

```auto
  vars.oracle_health["tablespace-usage-system"] = {
    oracle_health_name = "SYSTEM"
  }
  vars.oracle_health["tablespace-usage-users"] = {
    oracle_health_name = "USERS"
  }

```

and cut the `mode` inside the apply for loop, like

```auto
  if (match("tablespace-usage*", mode)) {
     vars.oracle_health_mode = "tablespace-usage"
  } else {
     vars.oracle_health_mode = mode
  }

```

or you’ll follow [this howto](https://community.icinga.com/t/dsl-flatten-a-nested-dictionary-with-a-function-for-apply-for-rules/1330) to flatten specific nested arrays. Keep in mind that this may not work with the other keys in `vars.oracle_health` then.

The main problem is that `oracle_health_name` only takes a single tablespace name, not arrays or lists.

Cheers,  
Michael

---

_[View the full topic](https://community.icinga.com/t/usage-of-dictionaries-for-oracle-health-and-tablespace-usage/1859)._
