09 Nov 2022 12:42 AM
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.
Solved! Go to Solution.
10 Nov 2022 09:52 PM
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
23 Jan 2024 10:26 AM - edited 23 Jan 2024 10:32 AM
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!
23 Jan 2024 11:28 AM
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
24 Jan 2024 07:32 AM
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?
14 Nov 2022 07:08 PM
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.
14 Dec 2022 08:44 PM
Please let me know if the solution helped you and if so, please accept the answer as a solution as well 🙂 Cheers!
14 Dec 2022 09:50 PM
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.
03 Jan 2023 03:17 PM
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.
03 Jan 2023 11:16 PM
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 .