19 Dec 2023 03:50 PM
In our tenant we have approx 400 management zones, many created in error. My job is to to remove the unnecessary ones. I have prepared my list to delete (those with no hosts, no processes etc) which I can delete manually (boring) or via the API (preferred as I am lazy programmer type).
However, I wanted like to know if it is possible, to restore a deleted management zone in case I make a mistake and I can, again using the API. However in the API docs Management zones API - POST a management zone - Dynatrace Docs it says that the MZ ID field is optional but actually if I create the MZ with the previously used ID, then the API complains about a constraint violation and if I remove that ID field then it gets created fine. So I think optional means that the value should not be there... and perhaps ID can be there but with a blank value.
So maybe the docs could do with a correction... but that aside, my question is really whether it is possible to re-create the same MZ config on a tenant somehow? I want to use the same ID in case it is referenced somewhere else that I forgot to check before I deleted in the first place.
Hope my question is clear...
Solved! Go to Solution.
20 Dec 2023 04:52 AM - edited 20 Dec 2023 05:29 AM
Hi @HeadScratcher ,
You can use Monaco, for more details please check the following Link
https://docs.dynatrace.com/docs/shortlink/configuration-as-code-monaco
Best Regards,
Mohamed
20 Dec 2023 10:10 AM
Exactly that is the best way to go😊
20 Dec 2023 02:49 PM
I am not sure that it is... see above reply.
20 Dec 2023 02:49 PM
Monaco is just an alternative way to call the API I believe...
21 Dec 2023 11:42 AM
I had some suggestions from live support chat to suggest alternative API methods etc... posting the findings in case anyone finds useful in the future.
Assuming original MZ ID number of '-2800715523779578223' and this management zone is deleted.
Conclusion is that post works fine for creating a new MZ but with a proviso that DT will not allow re-use of ID numbers. With this in mind it is not possible to back up management zones fully, just the names/config.
In my scenario If I need to back up I will need to fix any dependent resources like alert profiles
Others have suggested Monaco but I don't think that will help any differently since that is just the API behind a different interface (confirmed by DT Live support).