# Monaco: Maintenance Window Creation Automation

**URL:** <https://community.dynatrace.com/t/monaco-maintenance-window-creation-automation/52827>\
**Category:** Automations\
**Tags:** monaco, maintenance-window, automations\
**Created:** [August 6, 2025, 11:17am UTC](https://community.dynatrace.com/t/monaco-maintenance-window-creation-automation/52827 "2025-08-06T11:17:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jordi2](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jordi2](https://community.dynatrace.com/u/Jordi2)\
**Post date:** [August 6, 2025, 11:17am UTC](https://community.dynatrace.com/t/monaco-maintenance-window-creation-automation/52827/1 "2025-08-06T11:17:03Z")

</div>

Hello, I am seeking assistance with the following challenge we are encountering.

# Context

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.

# Current Logic of the Script

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](https://global.discourse-cdn.com/dynatrace/original/1X/1cf8757c834f5a62056e0f37648c02f35f5b5857.png)

The _mw.json_ file shown below contains the configuration values needed for each MW, depicted below.

 ![mw.json](https://global.discourse-cdn.com/dynatrace/original/3X/d/6/d623349c26c5c6c582b5ef4791aecae646cedc7d.png)

# Problem We Encounter

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,&nbsp;to my understanding, the _id_ is specific to Monaco CLI as a unique reference to a specific Dynatrace entity.

# My Questions

- What workaround exists for this?
  - Can I make the _id_ dynamic, similar to how other parameters are dynamically updated between iterations by changing the corresponding environment variable?

- Is Monaco suitable for this kind of use case?
  - Is performing direct calls to Dynatrace’s API a better approach?

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.

---

<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:** [August 7, 2025, 7:23am UTC](https://community.dynatrace.com/t/monaco-maintenance-window-creation-automation/52827/2 "2025-08-07T07:23:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jordi2](https://avatars.discourse-cdn.com/v4/letter/j/65b543/32.png) [@Jordi2](https://community.dynatrace.com/u/Jordi2)\
**Post date:** [August 7, 2025, 10:53am UTC](https://community.dynatrace.com/t/monaco-maintenance-window-creation-automation/52827/3 "2025-08-07T10:53:06Z")

</div>

Hi,

Thanks for your feedback.

I have implemented it using the API instead of Monaco and, indeed, this removes the&nbsp;_id_&nbsp;problem.

Kind regards
