cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Creating and Restoring Management Zones

HeadScratcher
Visitor

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... 

5 REPLIES 5

Mohamed_Hamdy
DynaMight Champion
DynaMight Champion

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

Certified Dynatrace Professional | Certified Dynatrace Services Delivery - Observability & CloudOps | Dynatrace Partner - yourcompass.ca

Exactly that is the best way to go😊

Have a nice day!

I am not sure that it is... see above reply. 

Monaco is just an alternative way to call the API I believe... 

HeadScratcher
Visitor

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.

  • Using post to create (including previous id) response=400 "Constraints violated." "The payload must not have an id set.
  • Using Put as suggested by Dynatrace Live Chat response=405 'Method Not Allowed' "Not allowed HTTP method, expected one of [POST, GET, OPTIONS]"
  • Using post (including tag but no value) response=400 "Constraints violated." "The payload must not have an id set
  • Using post (with id tag but value set to blank string ie no id value present) response=400, Constraints violated Not a valid 64-bit number.
  • Using post (without id key / value present) response=201 Created id: -1185889278300505254 name:blah (OK MZ recreated with a new ID number)

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).

Featured Posts