Python scripting examples for the Dynatrace API utilizing the great Dynatrace Python API Client from the Dynatrace OSS team.
Requeired librarys can be installed via pip.
# The Dynatrace Python API Client library
~$ pip install dt
# For the graph in example 1
~$ pip install matplotlib
While the UI has an overview and there are metrics for HU consumption, you can't get it by Host Group.
This example shows a quick script to get the HU consumption across multiple environments by host group as CSV and Graph. It utilizes the Environment v1 Smartscape Topology - Hosts API.
If you don't have config as code yet, this can be a quick way to multiply configuration.
This example shows how to create extension endpoints for the Port Check Extesnion based on a csv list of servers.