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

Correlating ObjectIds with EntityIds?

jphchan
Frequent Guest

Hi Everyone, 

 

I'm having some trouble understanding how to map an ObjectId with an EntityId... or am I not thinking about this correctly?  Here is the context:  I'm trying to programmatically enable/disable monitoring or changing the monitoring mode on various hosts.  I'm quite familiar with the APIs used for getting things, but I'm only beginning to look at the Settings API.  It looks like the Settings API works with ObjectIds, but retrieving hosts gives you EntityIds.  So, I can locate the hosts I want to manipulate, but ... I can't map it to the objectId that contains the settings I want to update.

 

Am I going about this all wrong?  Am I crazy to approach it this way??  

 

Thanks in advance,

Jeff.

9 REPLIES 9

Tiit_Hallas
Dynatrace Helper
Dynatrace Helper

If you're talking about the "/api/v2/settings/objects?schemaIds=builtin:host.monitoring" endpoint, then It seems that the items' ObjectID is base64-encoded bitmap-style object that includes the Entity name in it. I'm not sure about the full encoded payload, but if you remove the first 12 bytes and last 8 bytes, you'd get a TLV schemed data.

 

An example from the tenant "umsaywsjuo": 

ObjectId: vu9U3hXa3q0AAAABABdidWlsdGluOmhvc3QubW9uaXRvcmluZwAESE9TVAAQRjk5REE0RUUwQjAwRjkyRQAkOGNmNDZlMzAtYTcxNC0zMzYzLWE0MzgtNmI2Y2JjODJhNjAxvu9U3hXa3q0

Base64 decoded value: \xBE\xEFT\xDE\x15\xDA\xDE\xAD\x00\x00\x00\x01\x00\x17builtin:host.monitoring\x00\x04HOST\x00\x10F99DA4EE0B00F92E\x00$8cf46e30-a714-3363-a438-6b6cbc82a601\xBE\xEFT\xDE\x15\xDA\xDE\xAD

Extracted TLV values:
 - builtin:host.monitoring
 - HOST
 - F99DA4EE0B00F92E
 - 8cf46e30-a714-3363-a438-6b6cbc82a601

Looking at the Entities in the mentioned domain it seems to add up: https://umsaywsjuo.dev.dynatracelabs.com/ui/entity/HOST-F99DA4EE0B00F92E

I had a life once. Then I bought my first computer ...

Hi @Tiit_Hallas , for notifications we are also seeing new objectId of length 140, So how to decode that value? And same for management Zones how to decode them?

Looking for your reply.

Thanks!

Seems to be a similar base64 encoded payload, as in the main question, so the similar approach can be used to see the values in the encoded payload

I had a life once. Then I bought my first computer ...

Hi @Tiit_Hallas thanks for replying, I have one question we have "751105553490959515" entityId for managementZones which we fetched using v1 API, but now after using v2 API we are getting "vu9U3hXa3q0AAAABABhidWlsdGluOm1hbmFnZW1lbnQtem9uZXMABnRlbmFudAAGdGVuYW50ACRiNmYyYjY4YS1hZmExLTQyODgtYjY0Mi0zNjA1YmJlYzE0MzW-71TeFdrerQ", so how to decode this to older value?

jphchan
Frequent Guest

Wow thanks I did not know about decomposing the ObjectIds into extracted values... this is really helpful thanks!  I'll check this out and reply back for everyone's benefit if they were experiencing the same question I have.

 

Please let me know if the solution helped you and if so, please accept the answer as a solution as well 🙂 Cheers!

I had a life once. Then I bought my first computer ...

Sorry for the delayed response!  We've been very busy with other priorities so I haven't had a chance to verify but on very preliminary tests, this looks extremely promising and accurate.  I will accept the solution once I've been able to verify, which I'm trying to carve out some time in my schedule to do.

jphchan
Frequent Guest

Hi having some issues with my python script decoding the base-64 object, just figured out that I needed to pad the objectId to get it to decode properly.  Just returned from the holidays so I'm back working on it.

jphchan
Frequent Guest

I've accepted the solution as I have tested the above and am able to break down the objectId into it's components, thus able to correlate that with an entity name.  What is still to be resolved is why none of the settings objects returned in the get all settings object call does not match even a single one of the hosts I want to disable.  I gather that is another question to ask .  

Featured Posts