10 Jan 2024 09:35 PM - last edited on 20 Aug 2024 02:51 PM by Michal_Gebacki
I'm trying to extract out the mgmt zone ID much like the user who created the post below. I can easily get the ID using the old deprecated endpoint at /config/v1/managementZones, see example output below.
How can I get the ID using the settings endpoint outlined here? I can't seem to get the information even after taking the object ID of the mgmt zone and passing it in through /v2/setttings/objects/{objectId}
Solved! Go to Solution.
11 Jan 2024 09:16 AM
Hi,
Try this way
1. In settings/object complete schemaIds: builtin:management-zones.
2. Find your MZ and copy your objectId (it's different from MZ id)
3. Then you can paste in settings/object/{objectId} this MZ object id
Best Regards 🙂
11 Jan 2024 12:16 PM
You are referring to the endpoint mentioned in this doc right? Have you actually been able to get the mgmt zone ID from these results? I had already looked at this option as noted in my original post and I don't see it there.
https://docs.dynatrace.com/docs/dynatrace-api/environment-api/settings/objects/get-objects
Below are the items I see from the results of settings/objects/{objectId}, I see nothing for a mgmt zone ID
objectId
summary
searchSummary
created
modified
modifiedBy
author
updateToken
scope
schemaId
schemaVersion
value (contains the mgmt zone rules)
11 Jan 2024 05:01 PM
Okay, my bad sorry. I thought you wanted MZ object id. As I look closer I don't see possibility to extract MZ id from settings API 😕 This is very interesting because this is key information anyone need and it's not included 🤔
11 Jan 2024 11:09 AM
If you just want a managementZoneID then you can get this in the UI
Setting > Preferences > Management Zones
Then if you drop down the details arrow, the url changes to include the MZ ID as shown below
https://{environmentid}.apps.dynatrace.com/ui/apps/dynatrace.classic.settings/ui/settings/builtin:management-zones?gtf=-2h&gf=all&id=a8d2ccba-abca-****-****-*************
Depending on your use case what you are using the ID, this is the simplest way.
Cheers,
Lawrence
11 Jan 2024 12:10 PM
I've tried that in the past. The ID you are referring to is not the ID I need, it is different then what you get when you hit the old managementZones endpoint. I should have also stated that I am using this in a script so checking individuals is not feasible.
As an example below is 1 mgmt zones I have looked at
ID shown in URL
00d5356f-0075-3b3d-8cf3-9ada41e2daa5
11 Jan 2024 07:06 PM
Thanks for the clarification @sivart_89
What are you trying to achieve with this, creating entitySelectors, or something else? 🙂
Thanks,
Lawrence
11 Jan 2024 07:21 PM - edited 19 Jan 2024 12:21 PM
We have a script that was working with the previous, deprecated endpoint. It would loop through the alerting profiles and identify the ones that are referencing a particular mgmt zone.
Using schema 'builtin:alerting.profile' for settings/object the results show the mgmt zone ID in the alerting profile, not the management zone name. Hence why I need to get the ID of the mgmt zone, then cross it with the output from the alerting profile and spit out the ones that have a matching ID.
Sample output
{
"items": [
{
"objectId": "<object id>",
"value": {
"name": "<alerting profile name>",
"managementZone": "<mgmt zone id that the alerting profile is using>",
"severityRules": [
11 Jan 2024 07:40 PM
Thanks for that @sivart_89 .
Are you using JavaScript for this in the new platform, or an external python script?
I might have something I can tailor to your use in a notebook/dashboard with JavaScript if it's in platform 🙂
Thanks,
Lawrence
11 Jan 2024 08:02 PM
External python script. I would prefer to not jump through hoops and create anything special, instead use the api and the data that should be there just like it was for the previous endpoint.
Hoping to hear from others if this will be changed in the future.
11 Jan 2024 08:29 PM
Understand now. In your api script, can you add the following fields:
objectId, summary, value
I am using the Environmentv2/Settings - Objects/settings/objects api as shown below
https://*****.dynatracelabs.com/api/v2/settings/objects?schemaIds=builtin%3Aalerting.profile&fields=objectId%2C%20summary%2C%20value
This should then show these:
{
"objectId": "****************************",
"summary": "Test App",
"value": {
"name": "Test App",
"managementZone": "85718**********",
Seems the ManagementZone is shown within value
I hope that resolves your issue
Thanks 🙂
Lawrence
11 Jan 2024 08:37 PM - edited 11 Jan 2024 08:37 PM
That isn't what I need. The result you provided which are the same as what I provided a few comments ago, show the mgmt zone ID tied to the alerting profile but tells you nothing about the name of the mgmt zone. How can I allow for input of the mgmt zone name in my script? With the previous endpoint you could input the mgmt zone name and get back the id of the mgmt zone, I don't see a way with the settings endpoint using schema builtin:management-zones
It doesn't make much sense to be inputting the mgmt zone ID into my script, that means nothing to me. I want to use the mgmt zone name just like I've been doing with the deprecated endpoint.
12 Jan 2024 08:35 AM
Hi @sivart_89 ,
This is not how you want to retrieve it, but you can easily get the ID with a Monaco export
24 Jan 2024 07:58 AM
Hi @gbaudart , what is a Monaco export? I am also facing same problem. In v1 Api management zone id was different and now in v2 it is different, so how we can extract or map older value with newer one?
25 Jan 2024 12:03 PM
For anyone interested this is what I received from support.
According to our development team, unfortunately this is a bit of a feature gap at the moment:
We are aware of this feature gap with APIv2 and therefore the MZ API won't be removed until this limitation is resolved.
We plan to eventually close this feature gap by getting rid of the numerical MZ-Ids and only use ObjectIds. An improvement plan has been created and this is currently being worked on but as of now, we have no timeline just yet.
29 Jan 2024 06:11 PM
Hi @sivart_89 , so once it is fixed will you update it on the document end as well?
06 Sep 2024 12:32 PM
Good news!
It's now possible to convert the Management Zone settings objectId into a Management Zone ID through the new Settings - Management zones Env v2 endpoint:
Hope that helps
18 Dec 2024 12:56 PM
The ID returned by this solution is not physically the same as the one I have. However, it is functional!
When I use it in my "Maintenance Window" creation script, it successfully creates the window with the correct management zone. 😎