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

Management Zone ID using Settings Objects Endpoint

sivart_89
Mentor

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}

https://community.dynatrace.com/t5/Dynatrace-API/Trying-to-get-the-ID-of-a-Management-Domain/m-p/225...

{
    "values": [
        {
            "id": "<id>",
            "name": "<name>",
            "description": "<description>"
        }
  ]
}
16 REPLIES 16

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 🙂

"The lions does not ally with the coyotes"

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)

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 🤔

"The lions does not ally with the coyotes"

LawrenceBarratt
Dynatrace Advisor
Dynatrace Advisor

@sivart_89 

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

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

ID shown from managementZones endpoint
6001292090469458

Thanks for the clarification @sivart_89 

What are you trying to achieve with this, creating entitySelectors, or something else? 🙂

Thanks,

Lawrence

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": [

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

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.

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

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.

gbaudart
DynaMight Champion
DynaMight Champion

Hi @sivart_89 ,
This is not how you want to retrieve it, but you can easily get the ID with a Monaco export

Observability Consultant - Dynatrace Professional Certified

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?

sivart_89
Mentor

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:

  • Reading a `builtin:alerting-profile` from the Settings API will always return the numerical MZ-Id as part of the payload.
  • Writing to a `builtin:alerting-profile` in the Settings API will accept either the numerical MZ-Id or the ObjectId of the MZ in the payload.
  • Currently, there's no good way in the API to convert a numerical MZ-Id to an ObjectId or vice versa.
  • Hence, to find the name of a MZ by numerical MZ-Id, you will have to use the deprecated MZ API.

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. 

Hi @sivart_89 , so once it is fixed will you update it on the document end as well?

thomas_c
Dynatrace Guide
Dynatrace Guide

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:

 

image (49).png

 

Hope that helps

Featured Posts