# Raise a problem when license consumption is close to limit

**URL:** <https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518>\
**Category:** Dynatrace Managed\
**Tags:** dynatrace-managed, licensing\
**Created:** [September 25, 2025, 1:18pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518 "2025-09-25T13:18:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [September 25, 2025, 1:18pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/1 "2025-09-25T13:18:53Z")

</div>

Hi,

We are using a Dynatrace Managed environment and would like to automatically raise a problem when license consumption (for example, DDUs) is close to being exhausted.

I checked the available metrics but couldn’t find anything like ddu.used or hostunits.used. I did see some metrics such as billing.ddu.log.total, but for DDUs there are also **metrics and traces** that need to be considered in the calculation, not just logs.

- Is there a way to monitor the overall license consumption across all DDU categories?
- Can we set up alerting or problem generation for approaching license limits in Dynatrace Managed?
- If there are no direct metrics, what would be the recommended approach to achieve this?

Any advice or best practices would be greatly appreciated.

Regards, Deni

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [September 25, 2025, 4:48pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/2 "2025-09-25T16:48:07Z")

</div>

Hi,

Managed is more limited about that.

For DDU categories, you can try [this dashboard](https://guu84124.apps.dynatrace.com/ui/apps/dynatrace.classic.dashboards/#dashboard;gtf=-7d%20to%20now;gf=all;id=19cb7251-2105-4331-bd70-102bce8749fd).

I do not know any way to alert automatically in Managed about that. I would say review before dashboard to checking trend, and compare to limit your license has.-

Best regards

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 25, 2025, 9:22pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/3 "2025-09-25T21:22:55Z")

</div>

For these purposes we developed an Extension 2.0 which creates metrics per Dynatrace environment and you can then alert using Metric events. It scrapes the Cluster API and writes metrics.

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [September 26, 2025, 9:16am UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/4 "2025-09-26T09:16:37Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364)Thanks for the reply!

If I understand correct you suggest to create a custom extension which calls API to collect the license information and the sent a custom event via v2/events/ingest?

I searched in the swagger but can’t find API to get licenses - I see only v1/config/clusterid&nbsp; and v1/clusterversion nothing more in v1, v2 and config APIs connected to cluster or license.

---

<div class="post-metadata">

**Author:** ![mark\_bley](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/mark_bley/32/20954_2.png) [@mark\_bley](https://community.dynatrace.com/u/mark_bley)\
**Post date:** [September 26, 2025, 10:42am UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/5 "2025-09-26T10:42:36Z")

</div>

In managed you should know from your license the amount of DDUs you have (i.e. a fixed number)

What you can do is have a metric event to alert on this, but keep in mind this will be per environment.

```markup
((builtin:billing.ddu.metrics.total:splitBy():sum:default(0):fold(sum))
+
(builtin:billing.ddu.log.total:splitBy():sum:default(0):fold(sum))
+
(builtin:billing.ddu.serverless.total:splitBy():sum:default(0):fold(sum))
+
(builtin:billing.ddu.events.total:splitBy():sum:default(0):fold(sum))
+
(builtin:billing.ddu.traces.total:splitBy():sum:default(0):fold(sum)))

```

That will give you the total amount used.

Let’s say your total available is 1M, so put as a static threshold in the metric event with something like 800k.

With an extension, script or synthetic-test you could extract this information for the whole cluster from this API&nbsp;[Export license data for 1 hour — Dynatrace Managed Docs](https://docs.dynatrace.com/managed/shortlink/api-cluster-get-license-consumption)

Also maybe something to have a look at are DDU pools, where you can assign a specific env a limit of DDUs allowed to be consumed.&nbsp;[Extending Dynatrace (Davis data units) — Dynatrace Docs](https://docs.dynatrace.com/docs/shortlink/davis-data-units#ddu-pools)

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [September 26, 2025, 2:08pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/6 "2025-09-26T14:08:33Z")

</div>

[@deni](https://community.dynatrace.com/user/90225)&nbsp; -&nbsp;[List all existing environments — Dynatrace Managed Docs](https://docs.dynatrace.com/managed/shortlink/api-cluster-environments-list-existing)  
This includes consumption data (Classic licensing per environment).

Mark’s answer is also valid if you need it for a single environment. We had a requirement to alert on DDU consumption for two environments together, which is not possible with metrics just from a single environment.

---

<div class="post-metadata">

**Author:** ![deni](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/deni/32/163_2.png) [@deni](https://community.dynatrace.com/u/deni)\
**Post date:** [October 3, 2025, 8:05am UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/7 "2025-10-03T08:05:29Z")

</div>

Hi,

I’m pasting the code which I’m using:

```markup
with requests.get(f"{DT_CLUSTER_URL}/api/cluster/v2/license/consumption", headers=headers, stream=True, verify=VERIFY_SSL) as response:
...
with inner_zip.open(json_filename) as json_file:
                with io.TextIOWrapper(json_file, encoding="utf-8") as text_file:
                    data = json.load(text_file)
                    env_entries = data.get("environmentBillingEntries", [])

                    for env in env_entries:
                        # Sum DDUs
                        for pool in env.get("davisDataUnits", []):
                            total_ddus += safe_float(pool.get("total", 0))

                        # Count hosts
                        host_usages = env.get("hostUsages", [])
                        total_hostunits += len(host_usages)

                        # Count DEMs (based on agent usages per host)
                        for host in host_usages:
                            total_dems += len(host.get("agentUsages", []))
print("Aggregated License Consumption (from license start until now):")
print(f" Total DDUs used: {total_ddus:.2f}")
print(f" Total DEMs used: {total_dems}")
print(f" Total Host Units used: {total_hostunits}")

```

I saw that there are two environments in this Managed Dynatrace Cluster. The information on the /cmc shows aggregating result for the current consumed/available licenses and that’s why I’m also aggregating the results. The problem is that the results which I get completely differs from these shown in the /cmc:

```markup
Aggregated License Consumption (from license start until now):
  Total DDUs used: 93747.71
  Total DEMs used: 4428
  Total Host Units used: 4424

```

but in the /cmc it is:

```markup
Host Units: 15/15
DEM: 2.07k/10k
DDU: 599.51k/900k

```

Can you help me with that?

Regards, Deni

---

<div class="post-metadata">

**Author:** ![\_Alexander](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/_alexander/32/23720_2.png) [@\_Alexander](https://community.dynatrace.com/u/_Alexander)\
**Post date:** [November 6, 2025, 10:13am UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/8 "2025-11-06T10:13:46Z")

</div>

Since Dynatrace Managed version 1.326, new Cluster v2 APIs are available for retrieving host, Davis data, and DEM unit information. For details, see&nbsp;[What's new in Dynatrace Managed version 1.326 — Dynatrace Managed Docs](https://docs.dynatrace.com/managed/shortlink/release-notes-managed-sprint-326#track-your-cluster-license-usage-via-api)

In an upcoming release, we will also provide cluster billing metrics that allow you to define alerts in the self-monitoring environment when your license units are running low. Stay tuned!

We will also provide a dashboard for tracking the cluster license usage. See this preview:

 ![Screenshot 2025-11-06 at 11.15.24.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/c691a2c5cc02829ed1e58e1d67acdb5e80b763a4.png)

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [November 6, 2025, 12:19pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/9 "2025-11-06T12:19:05Z")

</div>

Hi,

[@\_Alexander\_](https://community.dynatrace.com/user/4565)&nbsp;Thank you! Nice improvement!

Do you know if that dashboard is going to be deployed automatically or do we need to import it manually?

Best regards

---

<div class="post-metadata">

**Author:** ![\_Alexander](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/_alexander/32/23720_2.png) [@\_Alexander](https://community.dynatrace.com/u/_Alexander)\
**Post date:** [November 6, 2025, 2:49pm UTC](https://community.dynatrace.com/t/raise-a-problem-when-license-consumption-is-close-to-limit/53518/10 "2025-11-06T14:49:43Z")

</div>

It will be deployed automatically to the Local Self-Monitoring environment
