25 Sep 2025
02:18 PM
- last edited on
29 Sep 2025
07:41 AM
by
MaciejNeumann
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
Solved! Go to Solution.
25 Sep 2025 05:48 PM
Hi,
Managed is more limited about that.
For DDU categories, you can try this dashboard.
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
25 Sep 2025 10:22 PM
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.
26 Sep 2025 10:16 AM - edited 26 Sep 2025 11:06 AM
@Julius_LomanThanks 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 and v1/clusterversion nothing more in v1, v2 and config APIs connected to cluster or license.
26 Sep 2025 03:08 PM
@deni - 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.
26 Sep 2025 11:42 AM
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.
((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 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. https://docs.dynatrace.com/docs/shortlink/davis-data-units#ddu-pools
03 Oct 2025 09:05 AM
Hi,
I'm pasting the code which I'm using:
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:
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:
Host Units: 15/15
DEM: 2.07k/10k
DDU: 599.51k/900k
Can you help me with that?
Regards, Deni