06 Aug 2025 12:17 PM
Hello, I am seeking assistance with the following challenge we are encountering.
Our goal is to automate the creation of maintenance windows (MW). We receive MW requests through our CMDB, which we can extract as JSON, and then use this data to create MWs in Dynatrace.
We started implementing this using Monaco within a Python script, which successfully deploys a MW.
The script loops through the MWs in the JSON file extracted from our CMDB. For each MW, it sets the appropriate values as environment variables for Monaco to use with the mw.yaml file shown below.
mw.yaml
The mw.json file shown below contains the configuration values needed for each MW, depicted below.
mw.json
Since the maintenanceWindowId (id in mw.yaml) is static, each iteration creates and deploys the same actual MW in Dynatrace—essentially updating the same existing MW rather than creating new ones. This is because, to my understanding, the id is specific to Monaco CLI as a unique reference to a specific Dynatrace entity.
Note that a possible solution could be editing the mw.yaml file during each iteration to assign a unique identifier. However, I prefer to keep mw.yaml as a generic template, and writing to a file each time isn't very time-efficient.
Thank you for your consideration. Please don't hesitate to ask if you need any additional information about the script setup.
Solved! Go to Solution.
07 Aug 2025 08:23 AM - edited 07 Aug 2025 08:24 AM
Hi,
I would say creating a unique identifier each time.
Or not using Monaco, make direct calls to API, I think you do not to play with IDs in that way.
Or using workflows to call CMDB, get data, and create maintance windows.
Best regards
07 Aug 2025 11:53 AM
Hi,
Thanks for your feedback.
I have implemented it using the API instead of Monaco and, indeed, this removes the id problem.
Kind regards